Update the tests for the new build and trigger apis.

This commit is contained in:
jakedt 2014-02-26 13:45:49 -05:00
parent 206049dbf8
commit 4e713d704f
2 changed files with 91 additions and 0 deletions

View file

@ -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:
```

View file

@ -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),
]