diff --git a/README.md b/README.md index aeae03870..c2d045c08 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,13 @@ running the tests: STACK=test python -m unittest discover ``` +running the tests with coverage (requires coverage module): + +``` +STACK=test coverage run -m unittest discover +coverage html +``` + generating screenshots: ``` diff --git a/test/specs.py b/test/specs.py index 65fb4332b..8506a9342 100644 --- a/test/specs.py +++ b/test/specs.py @@ -22,6 +22,9 @@ FAKE_USERNAME = str(uuid4()) FAKE_TOKEN = str(uuid4()) FAKE_WEBHOOK = str(uuid4()) +BUILD_UUID = '123' +TRIGGER_UUID = '123' + NEW_ORG_REPO_DETAILS = { 'repository': str(uuid4()), 'visibility': 'private', @@ -425,6 +428,87 @@ def build_specs(): TestSpec(url_for('api.list_repo_logs', repository=PRIVATE_REPO)), TestSpec(url_for('api.list_org_logs', orgname=ORG)), + + + TestSpec(url_for('api.get_repo_build_status', repository=PUBLIC_REPO, + build_uuid=BUILD_UUID), 400, 400, 400, 400), + TestSpec(url_for('api.get_repo_build_status', repository=ORG_REPO, + build_uuid=BUILD_UUID), 403, 403, 400, 400), + TestSpec(url_for('api.get_repo_build_status', repository=PRIVATE_REPO, + build_uuid=BUILD_UUID), 403, 403, 400, 400), + + TestSpec(url_for('api.get_repo_build_archive_url', repository=PUBLIC_REPO, + build_uuid=BUILD_UUID), 403, 403, 403, 403), + TestSpec(url_for('api.get_repo_build_archive_url', repository=ORG_REPO, + build_uuid=BUILD_UUID), 403, 403, 403, 400), + TestSpec(url_for('api.get_repo_build_archive_url', repository=PRIVATE_REPO, + build_uuid=BUILD_UUID), 403, 403, 403, 400), + + TestSpec(url_for('api.get_repo_build_logs', repository=PUBLIC_REPO, + build_uuid=BUILD_UUID), 403, 403, 403, 403), + TestSpec(url_for('api.get_repo_build_logs', repository=ORG_REPO, + build_uuid=BUILD_UUID), 403, 403, 403, 400), + TestSpec(url_for('api.get_repo_build_logs', repository=PRIVATE_REPO, + build_uuid=BUILD_UUID), 403, 403, 403, 400), + + TestSpec(url_for('api.get_build_trigger', repository=PUBLIC_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=403), + TestSpec(url_for('api.get_build_trigger', repository=ORG_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=404), + TestSpec(url_for('api.get_build_trigger', repository=PRIVATE_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=404), + + TestSpec(url_for('api.list_build_trigger_subdirs', repository=PUBLIC_REPO, + trigger_uuid=TRIGGER_UUID), 403, 403, 403, 403), + TestSpec(url_for('api.list_build_trigger_subdirs', repository=ORG_REPO, + trigger_uuid=TRIGGER_UUID), 403, 403, 403, 404), + TestSpec(url_for('api.list_build_trigger_subdirs', repository=PRIVATE_REPO, + trigger_uuid=TRIGGER_UUID), 403, 403, 403, 404), + + TestSpec(url_for('api.activate_build_trigger', repository=PUBLIC_REPO, + trigger_uuid=TRIGGER_UUID), 403, 403, 403, 403), + TestSpec(url_for('api.activate_build_trigger', repository=ORG_REPO, + trigger_uuid=TRIGGER_UUID), 403, 403, 403, 404), + TestSpec(url_for('api.activate_build_trigger', repository=PRIVATE_REPO, + trigger_uuid=TRIGGER_UUID), 403, 403, 403, 404), + + TestSpec(url_for('api.manually_start_build_trigger', + repository=PUBLIC_REPO, trigger_uuid=TRIGGER_UUID), + 403, 403, 403, 403), + TestSpec(url_for('api.manually_start_build_trigger', + repository=ORG_REPO, trigger_uuid=TRIGGER_UUID), + 403, 403, 403, 404), + TestSpec(url_for('api.manually_start_build_trigger', + repository=PRIVATE_REPO, trigger_uuid=TRIGGER_UUID), + 403, 403, 403, 404), + + TestSpec(url_for('api.list_trigger_recent_builds', repository=PUBLIC_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=403), + TestSpec(url_for('api.list_trigger_recent_builds', repository=ORG_REPO, + trigger_uuid=TRIGGER_UUID)), + TestSpec(url_for('api.list_trigger_recent_builds', repository=PRIVATE_REPO, + trigger_uuid=TRIGGER_UUID)), + + TestSpec(url_for('api.list_trigger_build_sources', repository=PUBLIC_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=403), + TestSpec(url_for('api.list_trigger_build_sources', repository=ORG_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=404), + TestSpec(url_for('api.list_trigger_build_sources', repository=PRIVATE_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=404), + + TestSpec(url_for('api.list_build_triggers', repository=PUBLIC_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=403), + TestSpec(url_for('api.list_build_triggers', repository=ORG_REPO, + trigger_uuid=TRIGGER_UUID)), + TestSpec(url_for('api.list_build_triggers', repository=PRIVATE_REPO, + trigger_uuid=TRIGGER_UUID)), + + TestSpec(url_for('api.delete_build_trigger', repository=PUBLIC_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=403), + TestSpec(url_for('api.delete_build_trigger', repository=ORG_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=404), + TestSpec(url_for('api.delete_build_trigger', repository=PRIVATE_REPO, + trigger_uuid=TRIGGER_UUID), admin_code=404), ]