From e5241c6d8803dd29aa229cf0c5d9c5665f6f5416 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Thu, 2 Jun 2016 11:59:16 -0400 Subject: [PATCH] tests: simple test for BuildRequest w/ archive URL --- test/test_api_usage.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/test/test_api_usage.py b/test/test_api_usage.py index b3c5f3a87..c7eaf9d6d 100644 --- a/test/test_api_usage.py +++ b/test/test_api_usage.py @@ -247,11 +247,11 @@ class TestDiscovery(ApiTestCase): class TestErrorDescription(ApiTestCase): - def test_get_error(self): - json = self.getJsonResponse(Error, params=dict(error_type='not_found')) - assert json['title'] == 'not_found' - assert 'type' in json - assert 'description' in json + def test_get_error(self): + json = self.getJsonResponse(Error, params=dict(error_type='not_found')) + assert json['title'] == 'not_found' + assert 'type' in json + assert 'description' in json class TestPlans(ApiTestCase): @@ -455,9 +455,11 @@ class TestConvertToOrganization(ApiTestCase): self.assertEquals(True, json['is_admin']) # Verify the now-org has no permissions. - count = (database.RepositoryPermission.select() - .where(database.RepositoryPermission.user == organization) - .count()) + count = (database + .RepositoryPermission + .select() + .where(database.RepositoryPermission.user == organization) + .count()) self.assertEquals(0, count) def test_convert_via_email(self): @@ -1814,6 +1816,15 @@ class TestGetRepository(ApiTestCase): class TestRepositoryBuildResource(ApiTestCase): + + def test_repo_build_invalid_url(self): + self.login(ADMIN_ACCESS_USER) + + self.postJsonResponse(RepositoryBuildList, + params=dict(repository=ADMIN_ACCESS_USER + '/simple'), + data=dict(archive_url='hppt://quay.io'), + expected_code=400) + def test_cancel_invalidbuild(self): self.login(ADMIN_ACCESS_USER)