예제 #1
0
 def test_project_completion_exception(self, mock_db, mock_project_list,
                                       mock_print):
     mock_project_list.side_effect = sqlite3.Error
     gpm = GPM()
     gpm.project_completion()
     self.assertEqual(mock_print.call_count, 2)
     mock_db().rollback_data.assert_called_once()
예제 #2
0
 def test_project_completion_back(self, mock_print, mock_input, mock_menu,
                                  mock_project_list):
     mock_project_list.return_value = {'name': 'project_id'}
     mock_menu().draw_menu.return_value = 'BACK'
     gpm = GPM()
     gpm.project_completion()
     mock_project_list.assert_called_once()
     mock_menu().draw_menu.assert_called_once()
     mock_print.assert_called_once()
     mock_input.assert_called_once()
예제 #3
0
    def test_project_completion_no_member(self, mock_db, mock_print,
                                          mock_input, mock_menu,
                                          mock_project_list):
        mock_project_list.return_value = {'name': 'project_id'}
        mock_db().get_project_members.return_value = []
        mock_menu().draw_menu.return_value = 'name'
        gpm = GPM()
        gpm.project_completion()

        mock_project_list.assert_called_once()
        mock_menu().draw_menu.assert_called_once()
        mock_input.assert_called_once()
        mock_db().get_project_members.assert_called_once()
        self.assertEqual(mock_print.call_count, 2)