def test_get_permission(self, mock_get_permission): """Api should return information about permission.""" mock_get_permission.return_value = self.valid_test_data[0] response = Permission.get(1) self.assertEqual(response.status_code, 200) self.assertEqual(response.json['id'], self.valid_test_data[0]['id']) self.assertEqual(response.json['name'], self.valid_test_data[0]['name'])
def test_get_permission_not_exist(self, mock_get_permission, mock_abort): """Api should return information about permission.""" mock_get_permission.return_value = None Permission.get(1) mock_abort.assert_called_once_with(404, message="No such permission with ID=1")
def test_get_permission_wrong_id_case2(self, mock_abort): """Api should return information about permission.""" Permission.get(-1) mock_abort.assert_called_once_with(404, message="No such permission with ID=-1")