Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webapp/webapp/features/dependencies_information_for_opt_id.py
blob: 44ac70ee643f58fb99549b08da9966725fb96961 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
import os

from lettuce import step, world
from fabric.api import local, hide
from django.conf import settings
from nose.tools import assert_true, assert_equal


@step(u'And poll in fixture: "([^"]*)"')
def and_poll_in_fixture_fixture_name(step, fixture_name):
    location = lambda x: os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        "fixtures",
        fixture_name,
        x
    )
    db_name = settings.MONGO_SETTINGS['NAME']

    with hide('running', 'output'):
        polls_fixture = location("polls.bson")
        local(
            "mongorestore --collection polls --db %s "
            "%s" % (db_name, polls_fixture))
        structures_fixture = location("structures.bson")
        local(
            "mongorestore --collection structures --db %s "
            "%s" % (db_name, structures_fixture))


@step(u'And I click in "([^"]*)" dependency id')
def and_i_click_in_dependency_id(step, dependency_id):
    b = world.browser
    b.find_by_value(dependency_id).click()


@step(u'Then I should see popover with title "([^"]*)" and content "([^"]*)"')
def see_popover_with_title_and_content(step, popover_title, popover_content):
    b = world.browser
    assert_true(b.is_element_present_by_css('.popover'))

    popover_title_element = b.find_by_css('.popover .popover-title')
    assert_equal(popover_title, popover_title_element.text)

    popover_title_content = b.find_by_css('.popover .popover-content')
    assert_equal(popover_content, popover_title_content.text)