Fix handling of repository names that match known endpoints (build, trigger, etc) and add tests to ensure it is fixed
This commit is contained in:
parent
cbd8cf3bb5
commit
e699739b23
3 changed files with 69 additions and 57 deletions
|
@ -71,6 +71,9 @@ UPDATE_REPO_DETAILS = {
|
|||
'description': 'A new description',
|
||||
}
|
||||
|
||||
FAKE_TRIGGER_CONFIG = {
|
||||
'active': True
|
||||
}
|
||||
|
||||
class TestSpec(object):
|
||||
def __init__(self, url, anon_code=401, no_access_code=403, read_code=403,
|
||||
|
@ -458,29 +461,31 @@ def build_specs():
|
|||
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.list_build_trigger_subdirs',
|
||||
repository=PUBLIC_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
401, 403, 403, 403).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
TestSpec(url_for('api.list_build_trigger_subdirs',
|
||||
repository=ORG_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
401, 403, 403, 404).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
TestSpec(url_for('api.list_build_trigger_subdirs', repository=PRIVATE_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
401, 403, 403, 404).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
|
||||
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.activate_build_trigger', repository=PUBLIC_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
401, 403, 403, 403).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
TestSpec(url_for('api.activate_build_trigger', repository=ORG_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
401, 403, 403, 404).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
TestSpec(url_for('api.activate_build_trigger', repository=PRIVATE_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
401, 403, 403, 404).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
|
||||
TestSpec(url_for('api.manually_start_build_trigger',
|
||||
repository=PUBLIC_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
403, 403, 403, 403),
|
||||
401, 403, 403, 403).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
TestSpec(url_for('api.manually_start_build_trigger',
|
||||
repository=ORG_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
403, 403, 403, 404),
|
||||
401, 403, 403, 404).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
TestSpec(url_for('api.manually_start_build_trigger',
|
||||
repository=PRIVATE_REPO, trigger_uuid=TRIGGER_UUID),
|
||||
403, 403, 403, 404),
|
||||
401, 403, 403, 404).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
||||
|
||||
TestSpec(url_for('api.list_trigger_recent_builds', repository=PUBLIC_REPO,
|
||||
trigger_uuid=TRIGGER_UUID), admin_code=403),
|
||||
|
|
Reference in a new issue