Example #1
0
    def test_assign_members_to_projects_back(self, mock_input, mock_menu,
                                             mock_project_list, mock_print):
        mock_project_list.return_value = {'project_name': 'project_id'}
        mock_menu().draw_menu.return_value = 'BACK'

        gpm = GPM()
        gpm.assign_members_to_projects()

        mock_print.assert_called_once()
        mock_input.assert_called_once()
        mock_menu().draw_menu.assert_called_once()
        mock_project_list.assert_called_once()
Example #2
0
    def test_assign_members_to_projects_member_exceeded(
            self, mock_db, mock_input, mock_menu, mock_member_list,
            mock_project_list, mock_print):
        mock_member_list.return_value = {
            'name': 'member_id',
            'name2': 'member_id2'
        }
        mock_project_list.return_value = {'project_name': 'project_id'}
        mock_db().get_project_members.return_value = [['member_id']]
        mock_db().get_project_members_required.return_value = [1]
        mock_menu().draw_menu.return_value = 'project_name'

        gpm = GPM()
        gpm.assign_members_to_projects()

        mock_member_list.assert_called_once()
        self.assertEqual(mock_menu().draw_menu.call_count, 1)
        self.assertEqual(mock_input.call_count, 1)
        self.assertEqual(mock_print.call_count, 3)
        mock_db().get_project_members_required.assert_called_once()
        mock_db().get_project_members.assert_called_once()
Example #3
0
    def test_assign_members_to_projects(self, mock_db, mock_input, mock_menu,
                                        mock_member_list, mock_project_list,
                                        mock_member_request, mock_print):
        mock_member_list.return_value = {
            'name': 'member_id',
            'name2': 'member_id2'
        }
        mock_project_list.return_value = {'project_name': 'project_id'}
        mock_db().get_project_members.return_value = [['member_id']]
        mock_db().get_project_members_required.return_value = [2]
        mock_menu().draw_menu.side_effect = ['project_name', 'name2']

        gpm = GPM()
        gpm.assign_members_to_projects()

        mock_member_list.assert_called_once()
        mock_member_request.assert_called_once()
        self.assertEqual(mock_menu().draw_menu.call_count, 2)
        self.assertEqual(mock_input.call_count, 2)
        self.assertEqual(mock_print.call_count, 2)
        mock_db().get_project_members_required.assert_called_once()
        mock_db().get_project_members.assert_called_once()