def test_get_project_not_found( self, mock_abort, mock_getitem, mock_auth ): mock_getitem.side_effect = Projects.ProjectNotFoundError() with app.test_request_context(self.template_url % self.project_name): with self.assertRaises(Projects.ProjectNotFoundError): p = Projects() p.get(self.project_name) self.assertEqual(mock.call(404), mock_abort.call_args) self.assertTrue(mock_auth.called) self.assertTrue(mock_getitem.called)
def test_get_str_projname(self, mock_getitem, mock_verify_user): mock_getitem.return_value = self.project with app.test_request_context(self.template_url % self.project_name): p = Projects() response = p.get(self.project_name) self.assertEqual(response.status_code, 200) self.assertTrue(mock_verify_user.called)