def test_no_module_name(self, mock_get_name, mock_get_cred, mock_ctx): mock_get_name.return_value = None mock_get_cred.return_value = ('consumer1', 'repo1') mock_ctx.env = {} result = api.Releases().GET() self.assertTrue(isinstance(result, web.webapi.BadRequest))
def test_no_version(self, mock_get_name, mock_get_cred, mock_input, mock_view): mock_get_cred.return_value = ('consumer1', 'repo1') mock_get_name.return_value = 'foo/bar' mock_input.return_value = {} mock_view.return_value = {} result = api.Releases().GET() self.assertEqual(result, json.dumps({})) mock_view.assert_called_once_with('consumer1', 'repo1', module_name='foo/bar', version=None)
def test_no_credentials(self, mock_ctx): mock_ctx.env = {} result = api.Releases().GET() self.assertTrue(isinstance(result, web.webapi.Unauthorized))