def test_issues_controller_submit_the_filters_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.issues.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectKeys.ISSUES) project_detail_controller.handle(config.ProjectIssuesKeys.FILTERS) filters_popup = project_detail_controller.view.issues.filters_popup project_view.issues.notifier.reset_mock() executor.issues.reset_mock() assert project_view.issues.notifier.info_msg.call_count == 0 assert executor.issues.call_count == 0 filters_popup._issue_types_group[0].set_state(True) filters_popup._issue_statuses_group[0].set_state(True) filters_popup._priorities_group[0].set_state(True) filters_popup._severities_group[0].set_state(True) filters_popup._assigned_to_group[0].set_state(True) filters_popup._created_by_group[0].set_state(True) #filters_popup._tags_group[0].set_state(True) signals.emit(filters_popup.filter_button, "click") assert project_view.issues.notifier.info_msg.call_count == 1 assert executor.issues.call_count == 1 assert len(filters_popup._filters) == 7 assert len(executor.issues.call_args.call_list()[0][1]["filters"]["type"]) == 1 assert len(executor.issues.call_args.call_list()[0][1]["filters"]["status"]) == 1 assert len(executor.issues.call_args.call_list()[0][1]["filters"]["severity"]) == 1 assert len(executor.issues.call_args.call_list()[0][1]["filters"]["priority"]) == 1 assert len(executor.issues.call_args.call_list()[0][1]["filters"]["assigned_to"]) == 1 assert len(executor.issues.call_args.call_list()[0][1]["filters"]["owner"]) == 1
def test_sprint_controller_submit_edit_user_story_form_successfully(): us_subject = "Update a user story" project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor( update_user_story_response=factories.future( factories.successful_update_user_story_response(us_subject))) _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.handle(settings.data.milestone.keys.edit) form = project_detail_controller.sprint.view.user_story_form project_view.sprint.notifier.reset_mock() form._subject_edit.set_edit_text(us_subject) signals.emit(form.save_button, "click") assert project_view.sprint.notifier.info_msg.call_count == 1 assert (executor.update_user_story.call_args.call_list()[0][0][0]["id"] == form.user_story["id"]) assert executor.update_user_story.call_args.call_list( )[0][0][1]["subject"] == us_subject assert executor.update_user_story.call_count == 1 assert executor.update_user_story.return_value.result( )["subject"] == us_subject
def test_sprint_controller_submit_edit_task_form_successfully(): task_subject = "Update a task" task_user_story = 12 project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor(update_task_response=factories.future( factories.successful_update_task_response(task_subject, task_user_story))) _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.sprint.view.taskboard.widget.set_focus(1) project_detail_controller.handle(settings.data.milestone.keys.edit) form = project_detail_controller.sprint.view.task_form project_view.sprint.notifier.reset_mock() form._subject_edit.set_edit_text(task_subject) form._user_story_combo.get_selected().value = task_user_story signals.emit(form.save_button, "click") assert project_view.sprint.notifier.info_msg.call_count == 1 assert (executor.update_task.call_args.call_list()[0][0][0]["id"] == form.task["id"]) assert executor.update_task.call_args.call_list()[0][0][1]["subject"] == task_subject assert (executor.update_task.call_args.call_list()[0][0][1]["milestone"] == project_detail_controller.sprint.view._milestone["id"]) assert executor.update_task.call_args.call_list()[0][0][1]["user_story"] == task_user_story assert executor.update_task.call_count == 1 assert executor.update_task.return_value.result()["subject"] == task_subject assert (executor.update_task.return_value.result()["milestone"] == project_detail_controller.sprint.view._milestone["id"]) assert executor.update_task.return_value.result()["user_story"] == task_user_story
def test_sprint_controller_change_to_another_milestone(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.handle(settings.data.milestone.keys.change_to_milestone) milestone_selector_popup = project_detail_controller.view.sprint.milestone_selector_popup project_view.sprint.notifier.reset_mock() executor.milestone.reset_mock() executor.milestone_stats.reset_mock() executor.user_stories.reset_mock() executor.tasks.reset_mock() assert project_view.sprint.notifier.info_msg.call_count == 0 assert executor.milestone.call_count == 0 assert executor.milestone_stats.call_count == 0 assert executor.user_stories.call_count == 0 assert executor.tasks.call_count == 0 signals.emit(milestone_selector_popup.options[2], "click") assert project_view.sprint.notifier.info_msg.call_count == 1 assert executor.milestone.call_count == 1 assert executor.milestone_stats.call_count == 1 assert executor.user_stories.call_count == 1 assert executor.tasks.call_count == 1 assert (project_detail_controller.sprint.view._milestone["id"] == milestone_selector_popup.project["list_of_milestones"][-1]["id"])
def test_sprint_controller_change_to_another_milestone(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.handle( settings.data.milestone.keys.change_to_milestone) milestone_selector_popup = project_detail_controller.view.sprint.milestone_selector_popup project_view.sprint.notifier.reset_mock() executor.milestone.reset_mock() executor.milestone_stats.reset_mock() executor.user_stories.reset_mock() executor.tasks.reset_mock() assert project_view.sprint.notifier.info_msg.call_count == 0 assert executor.milestone.call_count == 0 assert executor.milestone_stats.call_count == 0 assert executor.user_stories.call_count == 0 assert executor.tasks.call_count == 0 signals.emit(milestone_selector_popup.options[2], "click") assert project_view.sprint.notifier.info_msg.call_count == 1 assert executor.milestone.call_count == 1 assert executor.milestone_stats.call_count == 1 assert executor.user_stories.call_count == 1 assert executor.tasks.call_count == 1 assert (project_detail_controller.sprint.view._milestone["id"] == milestone_selector_popup.project["list_of_milestones"][-1]["id"])
def test_project_detail_controller_fetches_user_stories_and_transitions_to_backlog(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() state_machine = StateMachine(mock.Mock(), StateMachine.PROJECTS) project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, state_machine) assert state_machine.state == state_machine.PROJECT_BACKLOG
def test_backlog_controller_show_the_new_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "user_story_form") project_detail_controller.handle(settings.data.backlog.keys.create) assert hasattr(project_detail_controller.view.backlog, "user_story_form")
def test_backlog_controller_show_the_help_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "help_popup") project_detail_controller.handle(config.ProjectBacklogKeys.HELP) assert hasattr(project_detail_controller.view.backlog, "help_popup")
def test_backlog_controller_show_the_milestone_selector_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "milestone_selector_popup") project_detail_controller.handle(settings.data.backlog.keys.move_to_milestone) assert hasattr(project_detail_controller.view.backlog, "milestone_selector_popup")
def test_backlog_controller_show_the_new_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "user_story_form") project_detail_controller.handle(config.ProjectBacklogKeys.CREATE_USER_STORY) assert hasattr(project_detail_controller.view.backlog, "user_story_form")
def test_backlog_controller_show_the_milestone_selector_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "milestone_selector_popup") project_detail_controller.handle(config.ProjectBacklogKeys.MOVE_US_TO_MILESTONE) assert hasattr(project_detail_controller.view.backlog, "milestone_selector_popup")
def test_backlog_controller_update_user_stories_order_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor(update_user_stories_order_response=factories.future(None)) _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectBacklogKeys.UPDATE_USER_STORIES_ORDER) assert project_view.backlog.notifier.error_msg.call_count == 1
def test_backlog_controller_update_user_stories_order_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor(update_user_stories_order_response=factories.future(None)) _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.update_order) assert project_view.backlog.notifier.error_msg.call_count == 1
def test_project_detail_controller_fetches_issues_and_transitions_to_issues(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() state_machine = StateMachine(mock.Mock(), StateMachine.PROJECTS) project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, state_machine) assert state_machine.state == state_machine.PROJECT_BACKLOG project_detail_controller.handle(config.ProjectKeys.ISSUES) assert state_machine.state == state_machine.PROJECT_ISSUES
def test_issues_controller_show_the_new_issue_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectKeys.ISSUES) assert not hasattr(project_detail_controller.view.issues, "issue_form") project_detail_controller.handle(config.ProjectIssuesKeys.CREATE_ISSUE) assert hasattr(project_detail_controller.view.issues, "issue_form")
def test_backlog_controller_update_user_stories_order_with_success(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_view.backlog.notifier.reset_mock() project_detail_controller.handle(settings.data.backlog.keys.update_order) assert project_view.backlog.notifier.info_msg.call_count == 1
def test_backlog_controller_show_the_help_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "help_popup") project_detail_controller.handle(settings.data.backlog.keys.help) assert hasattr(project_detail_controller.view.backlog, "help_popup")
def test_issues_controller_show_the_filters_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.issues) assert not hasattr(project_detail_controller.view.issues, "filters_popup") project_detail_controller.handle(settings.data.issues.keys.filters) assert hasattr(project_detail_controller.view.issues, "filters_popup")
def test_project_detail_controller_fetches_wiki_pages_and_transitions_to_wiki(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() state_machine = StateMachine(mock.Mock(), StateMachine.PROJECTS) project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, state_machine) assert state_machine.state == state_machine.PROJECT_BACKLOG project_detail_controller.handle(settings.data.main.keys.wiki) assert state_machine.state == state_machine.PROJECT_WIKI
def test_project_detail_controller_fetches_task_and_transitions_to_sprint_taskboard(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() state_machine = StateMachine(mock.Mock(), StateMachine.PROJECTS) project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, state_machine) assert state_machine.state == state_machine.PROJECT_BACKLOG project_detail_controller.handle(settings.data.main.keys.milestone) assert state_machine.state == state_machine.PROJECT_MILESTONES
def test_issues_controller_show_the_filters_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectKeys.ISSUES) assert not hasattr(project_detail_controller.view.issues, "filters_popup") project_detail_controller.handle(config.ProjectIssuesKeys.FILTERS) assert hasattr(project_detail_controller.view.issues, "filters_popup")
def test_sprints_controller_show_the_help_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectKeys.MILESTONES) assert not hasattr(project_detail_controller.view.sprint, "help_popup") project_detail_controller.handle(config.ProjectMilestoneKeys.HELP) assert hasattr(project_detail_controller.view.sprint, "help_popup")
def test_sprints_controller_show_the_help_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) assert not hasattr(project_detail_controller.view.sprint, "help_popup") project_detail_controller.handle(settings.data.milestone.keys.help) assert hasattr(project_detail_controller.view.sprint, "help_popup")
def test_backlog_controller_update_user_stories_order_with_success(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_view.backlog.notifier.reset_mock() project_detail_controller.handle(settings.data.backlog.keys.update_order) assert project_view.backlog.notifier.info_msg.call_count == 1
def test_backlog_controller_update_user_stories_order_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor( update_user_stories_order_response=factories.future(None)) _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.update_order) assert project_view.backlog.notifier.error_msg.call_count == 1
def test_backlog_controller_submit_new_user_stories_in_bulk_form_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectBacklogKeys.CREATE_USER_STORIES_IN_BULK) form = project_detail_controller.view.backlog.user_stories_in_bulk_form signals.emit(form.save_button, "click") assert project_view.backlog.notifier.error_msg.call_count == 1
def test_backlog_controller_show_the_new_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "user_story_form") project_detail_controller.handle(settings.data.backlog.keys.create) assert hasattr(project_detail_controller.view.backlog, "user_story_form")
def test_backlog_controller_close_the_milestone_selector_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectBacklogKeys.MOVE_US_TO_MILESTONE) assert hasattr(project_detail_controller.view.backlog, "milestone_selector_popup") milestone_selector_popup = project_detail_controller.view.backlog.milestone_selector_popup signals.emit(milestone_selector_popup.cancel_button, "click") assert not hasattr(project_detail_controller.view.backlog, "milestone_selector_popup")
def test_backlog_controller_submit_new_user_story_form_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.create) form = project_detail_controller.view.backlog.user_story_form signals.emit(form.save_button, "click") assert project_view.backlog.notifier.error_msg.call_count == 1
def test_backlog_controller_cancel_the_new_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.create) assert hasattr(project_detail_controller.view.backlog, "user_story_form") form = project_detail_controller.view.backlog.user_story_form signals.emit(form.cancel_button, "click") assert not hasattr(project_detail_controller.view.backlog, "user_story_form")
def test_backlog_controller_show_the_edit_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "user_story_form") project_detail_controller.handle(settings.data.backlog.keys.edit) assert hasattr(project_detail_controller.view.backlog, "user_story_form") assert (project_detail_controller.view.backlog.user_story_form.user_story == project_detail_controller.view.backlog.user_stories.widget.get_focus().user_story)
def test_sprint_controller_show_the_new_task_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.sprint.view.taskboard.widget.set_focus(1) assert not hasattr(project_detail_controller.sprint.view, "task_form") project_detail_controller.handle(settings.data.milestone.keys.create_task) assert hasattr(project_detail_controller.sprint.view, "task_form")
def test_sprint_controller_show_the_new_task_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectKeys.MILESTONES) project_detail_controller.sprint.view.taskboard.widget.set_focus(1) assert not hasattr(project_detail_controller.sprint.view, "task_form") project_detail_controller.handle(config.ProjectMilestoneKeys.CREATE_TASK) assert hasattr(project_detail_controller.sprint.view, "task_form")
def test_backlog_controller_cancel_the_new_user_stories_in_bulk_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(config.ProjectBacklogKeys.CREATE_USER_STORIES_IN_BULK) assert hasattr(project_detail_controller.view.backlog, "user_stories_in_bulk_form") form = project_detail_controller.view.backlog.user_stories_in_bulk_form signals.emit(form.cancel_button, "click") assert not hasattr(project_detail_controller.view.backlog, "user_stories_in_bulk_form")
def test_issues_controller_show_the_new_issue_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.issues) assert not hasattr(project_detail_controller.view.issues, "issue_form") project_detail_controller.handle(settings.data.issues.keys.create) assert hasattr(project_detail_controller.view.issues, "issue_form")
def test_backlog_controller_close_the_milestone_selector_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.move_to_milestone) assert hasattr(project_detail_controller.view.backlog, "milestone_selector_popup") milestone_selector_popup = project_detail_controller.view.backlog.milestone_selector_popup signals.emit(milestone_selector_popup.cancel_button, "click") assert not hasattr(project_detail_controller.view.backlog, "milestone_selector_popup")
def test_backlog_controller_delete_user_story_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor(delete_user_story_response=factories.future(None)) _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController(project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.delete) assert project_view.backlog.notifier.error_msg.call_count == 1 assert (executor.delete_user_story.call_args.call_list()[0][0][0]["id"] == project_detail_controller.backlog.user_stories[0]["id"])
def test_backlog_controller_close_the_help_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.help) assert hasattr(project_detail_controller.view.backlog, "help_popup") help_popup = project_detail_controller.view.backlog.help_popup signals.emit(help_popup.close_button, "click") assert not hasattr(project_detail_controller.view.backlog, "help_popup")
def test_backlog_controller_submit_new_user_story_form_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.create) form = project_detail_controller.view.backlog.user_story_form signals.emit(form.save_button, "click") assert project_view.backlog.notifier.error_msg.call_count == 1
def test_sprint_controller_show_the_new_task_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.sprint.view.taskboard.widget.set_focus(1) assert not hasattr(project_detail_controller.sprint.view, "task_form") project_detail_controller.handle(settings.data.milestone.keys.create_task) assert hasattr(project_detail_controller.sprint.view, "task_form")
def test_issues_controller_cancel_the_filters_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.issues) project_detail_controller.handle(settings.data.issues.keys.filters) assert hasattr(project_detail_controller.view.issues, "filters_popup") filters_popup = project_detail_controller.view.issues.filters_popup signals.emit(filters_popup.cancel_button, "click") assert not hasattr(project_detail_controller.view.issues, "filters_popup")
def test_backlog_controller_delete_user_story_with_success(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.backlog.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_view.backlog.notifier.reset_mock() project_detail_controller.handle(settings.data.backlog.keys.delete) assert project_view.backlog.notifier.info_msg.call_count == 1 assert (executor.delete_user_story.call_args.call_list()[0][0][0]["id"] == project_detail_controller.backlog.user_stories[0]["id"])
def test_backlog_controller_cancel_the_new_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.backlog.keys.create) assert hasattr(project_detail_controller.view.backlog, "user_story_form") form = project_detail_controller.view.backlog.user_story_form signals.emit(form.cancel_button, "click") assert not hasattr(project_detail_controller.view.backlog, "user_story_form")
def test_backlog_controller_show_the_edit_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) assert not hasattr(project_detail_controller.view.backlog, "user_story_form") project_detail_controller.handle(settings.data.backlog.keys.edit) assert hasattr(project_detail_controller.view.backlog, "user_story_form") assert (project_detail_controller.view.backlog.user_story_form.user_story == project_detail_controller.view.backlog.user_stories.widget. get_focus().user_story)
def test_sprint_controller_cancel_the_edit_task_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.sprint.view.taskboard.widget.set_focus(1) project_detail_controller.handle(settings.data.milestone.keys.edit) assert hasattr(project_detail_controller.sprint.view, "task_form") form = project_detail_controller.sprint.view.task_form signals.emit(form.cancel_button, "click") assert not hasattr(project_detail_controller.sprint.view, "task_form")
def test_sprint_controller_delete_user_story_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor( delete_user_story_response=factories.future(None)) _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.handle(settings.data.milestone.keys.delete) assert project_view.sprint.notifier.error_msg.call_count == 1 assert (executor.delete_user_story.call_args.call_list()[0][0][0]["id"] == project_detail_controller.sprint.view._user_stories[0]["id"])
def test_sprint_controller_show_the_milestone_selector_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) assert not hasattr(project_detail_controller.view.sprint, "milestone_selector_popup") project_detail_controller.handle( settings.data.milestone.keys.change_to_milestone) assert hasattr(project_detail_controller.view.sprint, "milestone_selector_popup")
def test_backlog_controller_reload(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) executor.project_stats.reset_mock() executor.unassigned_user_stories.reset_mock() assert executor.project_stats.call_count == 0 assert executor.unassigned_user_stories.call_count == 0 project_detail_controller.handle(settings.data.backlog.keys.reload) assert executor.project_stats.call_count == 1 assert executor.unassigned_user_stories.call_count == 1
def test_issues_controller_show_the_edit_issue_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.issues) assert not hasattr(project_detail_controller.view.issues, "issue_form") project_detail_controller.handle(settings.data.issues.keys.edit) assert hasattr(project_detail_controller.view.issues, "issue_form") assert (project_detail_controller.view.issues.issue_form.issue == project_detail_controller.view.issues.issues.list_walker.get_focus( )[0].issue)
def test_sprint_controller_submit_the_edit_user_story_form_with_errors(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.handle(settings.data.milestone.keys.edit) form = project_detail_controller.sprint.view.user_story_form form._subject_edit.set_edit_text("") signals.emit(form.save_button, "click") assert project_view.sprint.notifier.error_msg.call_count == 1
def test_sprint_controller_show_the_new_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) assert not hasattr(project_detail_controller.sprint.view, "user_story_form") project_detail_controller.handle( settings.data.milestone.keys.create_user_story) assert hasattr(project_detail_controller.sprint.view, "user_story_form") assert (project_detail_controller.sprint.view.user_story_form.user_story[ "milestone"] == project_detail_controller.sprint.view._milestone["id"])
def test_issues_controller_reload(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.issues) executor.project_issues_stats.reset_mock() executor.issues.reset_mock() assert executor.project_issues_stats.call_count == 0 assert executor.issues.call_count == 0 project_detail_controller.handle(settings.data.issues.keys.reload) assert executor.project_issues_stats.call_count == 1 assert executor.issues.call_count == 1
def test_sprint_controller_delete_task_with_success(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_view.sprint.notifier.reset_mock() project_view.sprint.taskboard.list_walker.set_focus(2) project_detail_controller.handle(settings.data.milestone.keys.delete) assert project_view.sprint.notifier.info_msg.call_count == 1 assert (executor.delete_task.call_args.call_list()[0][0][0]["id"] == project_detail_controller.sprint.view._tasks[1]["id"])
def test_sprint_controller_show_the_edit_user_story_form(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) assert not hasattr(project_detail_controller.sprint.view, "user_story_form") project_detail_controller.handle(settings.data.milestone.keys.edit) assert hasattr(project_detail_controller.sprint.view, "user_story_form") assert (project_detail_controller.sprint.view.user_story_form.user_story == project_detail_controller.sprint.view.taskboard.widget.get_focus() [0].user_story)
def test_sprint_controller_close_the_milestone_selector_popup(): project = factories.project() project_view = views.projects.ProjectDetailView(project) executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_detail_controller.handle( settings.data.milestone.keys.change_to_milestone) assert hasattr(project_detail_controller.view.sprint, "milestone_selector_popup") milestone_selector_popup = project_detail_controller.view.sprint.milestone_selector_popup signals.emit(milestone_selector_popup.cancel_button, "click") assert not hasattr(project_detail_controller.view.sprint, "milestone_selector_popup")
def test_sprint_controller_change_task_assigned_to(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_view.sprint.notifier.reset_mock() task = project_view.sprint.taskboard.widget.contents()[1][0] combo = task.base_widget.widget.contents[2][0] # 2 => assigned_to item = combo.menu.get_item(0) # 0 combo.item_changed(item, True) assert project_view.sprint.notifier.info_msg.call_count == 1 assert executor.update_task.call_args.call_list( )[0][0][1]["assigned_to"] == item.value assert executor.update_task.call_count == 1
def test_sprint_controller_change_user_story_points(): project = factories.project() project_view = views.projects.ProjectDetailView(project) project_view.sprint.notifier = mock.Mock() executor = factories.patched_executor() _ = mock.Mock() project_detail_controller = controllers.projects.ProjectDetailController( project_view, executor, _) project_detail_controller.handle(settings.data.main.keys.milestone) project_view.sprint.notifier.reset_mock() us = project_view.sprint.taskboard.widget.contents()[0][0] combo = us.base_widget.widget.contents[3][0].contents[1][0] # 3 => points item = combo.menu.get_item(2) # 2 => 1/2 combo.item_changed(item, True) assert project_view.sprint.notifier.info_msg.call_count == 1 assert list(executor.update_user_story.call_args.call_list()[0][0][1] ["points"].values())[0] == item.value assert executor.update_user_story.call_count == 1