diff --git a/config.py b/config.py index 8616f47d4..4e20fdc8c 100644 --- a/config.py +++ b/config.py @@ -134,9 +134,9 @@ class BuildNodeConfig(object): class TestConfig(FlaskConfig, FakeStorage, EphemeralDB, FakeUserfiles, - FakeAnalytics): + FakeAnalytics, StripeTestConfig): LOGGING_CONFIG = { - 'level': logging.DEBUG, + 'level': logging.WARN, 'format': LOG_FORMAT } POPULATE_DB_TEST_DATA = True diff --git a/endpoints/api.py b/endpoints/api.py index c21bb652d..080deee58 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -719,10 +719,7 @@ def update_repo_api(namespace, repository): def repo_logs_api(namespace, repository): permission = AdministerRepositoryPermission(namespace, repository) if permission.can(): - print namespace - print repository repo = model.get_repository(namespace, repository) - print repo if not repo: abort(404) diff --git a/test/specs.py b/test/specs.py index 9b819d4af..edaf42946 100644 --- a/test/specs.py +++ b/test/specs.py @@ -20,6 +20,7 @@ FAKE_IMAGE_ID = str(uuid4()) FAKE_TAG_NAME = str(uuid4()) FAKE_USERNAME = str(uuid4()) FAKE_TOKEN = str(uuid4()) +FAKE_WEBHOOK = str(uuid4()) NEW_ORG_REPO_DETAILS = { 'repository': str(uuid4()), @@ -29,9 +30,9 @@ NEW_ORG_REPO_DETAILS = { } NEW_USER_DETAILS = { - 'username': 'bob', + 'username': 'bobby', 'password': 'password', - 'email': 'jake@devtable.com', + 'email': 'bobby@tables.com', } SEND_RECOVERY_DETAILS = { @@ -217,6 +218,34 @@ def build_specs(): admin_code=201).set_method('POST') .set_data_from_obj(CREATE_BUILD_DETAILS)), + TestSpec(url_for('create_webhook', repository=PUBLIC_REPO), + admin_code=403).set_method('POST'), + TestSpec(url_for('create_webhook', + repository=ORG_REPO)).set_method('POST'), + TestSpec(url_for('create_webhook', + repository=PRIVATE_REPO)).set_method('POST'), + + TestSpec(url_for('get_webhook', repository=PUBLIC_REPO, + public_id=FAKE_WEBHOOK), admin_code=403), + TestSpec(url_for('get_webhook', repository=ORG_REPO, + public_id=FAKE_WEBHOOK), admin_code=400), + TestSpec(url_for('get_webhook', repository=PRIVATE_REPO, + public_id=FAKE_WEBHOOK), admin_code=400), + + TestSpec(url_for('list_webhooks', repository=PUBLIC_REPO), admin_code=403), + TestSpec(url_for('list_webhooks', repository=ORG_REPO)), + TestSpec(url_for('list_webhooks', repository=PRIVATE_REPO)), + + TestSpec(url_for('delete_webhook', repository=PUBLIC_REPO, + public_id=FAKE_WEBHOOK), + admin_code=403).set_method('DELETE'), + TestSpec(url_for('delete_webhook', repository=ORG_REPO, + public_id=FAKE_WEBHOOK), + admin_code=400).set_method('DELETE'), + TestSpec(url_for('delete_webhook', repository=PRIVATE_REPO, + public_id=FAKE_WEBHOOK), + admin_code=400).set_method('DELETE'), + TestSpec(url_for('list_repository_images', repository=PUBLIC_REPO), 200, 200, 200, 200), TestSpec(url_for('list_repository_images', repository=ORG_REPO), @@ -383,11 +412,11 @@ def build_specs(): TestSpec(url_for('get_org_subscription', orgname=ORG)), - TestSpec(url_for('repo_logs_api', repository=PUBLIC_REPO), 401, 403, 403, 403), - TestSpec(url_for('repo_logs_api', repository=ORG_REPO), 401, 403, 403, 200), - TestSpec(url_for('repo_logs_api', repository=PRIVATE_REPO), 401, 403, 403, 200), + TestSpec(url_for('repo_logs_api', repository=PUBLIC_REPO), admin_code=403), + TestSpec(url_for('repo_logs_api', repository=ORG_REPO)), + TestSpec(url_for('repo_logs_api', repository=PRIVATE_REPO)), - TestSpec(url_for('org_logs_api', orgname=ORG), 401, 403, 403, 200), + TestSpec(url_for('org_logs_api', orgname=ORG)), ] diff --git a/test/test_endpoint_security.py b/test/test_endpoint_security.py index 33845ec88..e762ec5ea 100644 --- a/test/test_endpoint_security.py +++ b/test/test_endpoint_security.py @@ -42,8 +42,6 @@ class _SpecTestBuilder(type): rv = c.open(url, **open_kwargs) msg = '%s %s: %s expected: %s' % (open_kwargs['method'], url, rv.status_code, expected_status) - if rv.status_code != expected_status: - print msg self.assertEqual(rv.status_code, expected_status, msg) return test diff --git a/util/seo.py b/util/seo.py index 8a4514b3b..42af53502 100644 --- a/util/seo.py +++ b/util/seo.py @@ -3,8 +3,9 @@ import logging from bs4 import BeautifulSoup + logger = logging.getLogger(__name__) -logging.basicConfig(level=logging.DEBUG) + def render_snapshot(url): logger.info('Snapshotting url: %s' % url)