예제 #1
0
    def test_delete_proj_not_found(self, mock_abort, mock_getitem,
                                   mock_verify_user):
        with self.assertRaises(Projects.ProjectNotFoundError):
            with app.test_request_context(
                            self.template_url % self.project_name):
                endpoint = Projects()
                endpoint.delete(self.project_name)

        self.assertTrue(mock_verify_user.called)
        self.assertTrue(mock_getitem.called)
        self.assertEqual(
            mock.call(404), mock_abort.call_args
        )
예제 #2
0
    def test_delete_str_project(
            self, mock_delete, mock_first, mock_verify_user
    ):
        mock_first.return_value = self.project

        with app.test_request_context(self.template_url % self.project_name):
            p = Projects()
            response = p.delete(self.project_name)

            self.assertEqual(response.status_code, 200)

        self.assertTrue(mock_verify_user.called)
        self.assertEqual(mock.call(self.project), mock_delete.call_args)