diff options
Diffstat (limited to 'webapp/webapp/features/remove_poll_results_from_poll.py')
-rw-r--r-- | webapp/webapp/features/remove_poll_results_from_poll.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/webapp/webapp/features/remove_poll_results_from_poll.py b/webapp/webapp/features/remove_poll_results_from_poll.py index 6b84c47..d5cbfff 100644 --- a/webapp/webapp/features/remove_poll_results_from_poll.py +++ b/webapp/webapp/features/remove_poll_results_from_poll.py @@ -1,17 +1,19 @@ +# pylint disable=C0111 import json from lettuce import step, world from nose.tools import assert_false, assert_true -from steps import login, get_fixture, create_poll_result_file, click_on -from polls.models import Poll +from steps import (login, get_fixture, create_poll_result_file, click_on, + get_poll_by_name) -@step(u'Given I am logged in as "([^"]*)"') -def given_i_am_logged_in_as_rol(step, rol): +@step(u'I am logged in as "([^"]*)"') +def i_am_logged_in_as_rol(step, rol): roles2generic_users = { 'Administrator': 'admin', - 'Researcher': 'researcher' + 'Researcher': 'researcher', + 'Pollster': 'encuestador' } browser = world.browser username = roles2generic_users[rol] @@ -21,9 +23,10 @@ def given_i_am_logged_in_as_rol(step, rol): @step(u'And "([^"]*)" has "([^"]*)"') -def and_poll_has_poll_result(step, poll_name, poll_result_name): +def poll_has_result(step, poll_name, poll_result_name): poll_result_path = get_fixture(poll_result_name) - poll_id = world.poll_id.__str__() + poll_id = str(get_poll_by_name(poll_name).id) + poll = get_poll_by_name(poll_name) with open(poll_result_path) as f: poll_result_data = json.load(f, "utf-8") @@ -33,7 +36,6 @@ def and_poll_has_poll_result(step, poll_name, poll_result_name): poll_result_path = create_poll_result_file(poll_result_data, poll_result_name) - poll = Poll.get(poll_id) path_and_name = (poll_result_path, poll_result_name) poll.add_result_files([path_and_name]) |