# -*- 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)