diff options
Diffstat (limited to 'webapp/webapp/features/steps.py')
-rw-r--r-- | webapp/webapp/features/steps.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/webapp/webapp/features/steps.py b/webapp/webapp/features/steps.py index 4c7d687..d696d51 100644 --- a/webapp/webapp/features/steps.py +++ b/webapp/webapp/features/steps.py @@ -60,7 +60,10 @@ def create_poll(name, status=Poll.OPEN): @step(u'And "([^"]*)" exists') def and_poll_name_exists(step, poll_name): - create_poll(poll_name) + try: + get_poll_by_name(poll_name) + except IndexError: + create_poll(poll_name) @step(u'And "([^"]*)" is "([^"]*)"') @@ -77,8 +80,10 @@ def and_encuestador_is_binded_to_poll(step, encuestador, poll_name): pollster = get_pollster_by_username(encuestador) except IndexError: pollster = Pollster.create(username=username, password=password) - polls = [world.poll_id] + poll_id = get_poll_by_name(poll_name).id.__str__() + polls = [poll_id] Poll.pollster_assignment(pollster.id, polls) + world.poll_id = poll_id def get_fixture(poll_result): @@ -110,14 +115,14 @@ def poll_result_uploaded_by_encuestador(step, poll_result_name, shutil.move(poll_result_path, results_dir) -@step(u'Then I should see a message that says "([^"]*)"$') +@step(u'I should see a message that says "([^"]*)"$') def i_should_see_a_message_that_says_text(step, text): b = world.browser assert_true(b.is_text_present(text)) def get_poll_by_name(poll_name): - return filter(lambda p: p.name == poll_name, Poll.all())[0] + return [poll for poll in Poll.all() if poll.name == poll_name][0] @step(u'I visit the "([^"]*)" page for "([^"]*)" poll') |