2013-11-06 22:56:31 +00:00
|
|
|
import json
|
|
|
|
|
|
|
|
from flask import url_for
|
|
|
|
from collections import OrderedDict
|
|
|
|
from uuid import uuid4
|
2013-11-07 22:10:57 +00:00
|
|
|
from base64 import b64encode
|
2013-11-06 22:56:31 +00:00
|
|
|
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO = None
|
2013-11-06 22:56:31 +00:00
|
|
|
PUBLIC_REPO = 'public/publicrepo'
|
2013-11-07 04:21:12 +00:00
|
|
|
PRIVATE_REPO = 'devtable/shared'
|
2013-11-06 22:56:31 +00:00
|
|
|
|
2013-11-08 03:43:43 +00:00
|
|
|
ORG = 'buynlarge'
|
2013-11-06 22:56:31 +00:00
|
|
|
ORG_REPO = ORG + '/orgrepo'
|
|
|
|
ORG_READERS = 'readers'
|
|
|
|
ORG_OWNER = 'devtable'
|
2013-11-07 04:21:12 +00:00
|
|
|
ORG_OWNERS = 'owners'
|
|
|
|
ORG_READERS = 'readers'
|
|
|
|
|
|
|
|
FAKE_IMAGE_ID = str(uuid4())
|
|
|
|
FAKE_TAG_NAME = str(uuid4())
|
|
|
|
FAKE_USERNAME = str(uuid4())
|
|
|
|
FAKE_TOKEN = str(uuid4())
|
2013-12-02 20:40:12 +00:00
|
|
|
FAKE_WEBHOOK = str(uuid4())
|
2013-11-07 04:21:12 +00:00
|
|
|
|
2014-02-26 18:45:49 +00:00
|
|
|
BUILD_UUID = '123'
|
|
|
|
TRIGGER_UUID = '123'
|
|
|
|
|
2013-11-07 04:21:12 +00:00
|
|
|
NEW_ORG_REPO_DETAILS = {
|
|
|
|
'repository': str(uuid4()),
|
|
|
|
'visibility': 'private',
|
|
|
|
'description': '',
|
|
|
|
'namespace': ORG,
|
|
|
|
}
|
2013-11-06 22:56:31 +00:00
|
|
|
|
2013-11-07 17:54:44 +00:00
|
|
|
NEW_USER_DETAILS = {
|
2013-12-02 21:16:45 +00:00
|
|
|
'username': 'bobby',
|
2013-11-07 17:54:44 +00:00
|
|
|
'password': 'password',
|
2013-12-02 21:16:45 +00:00
|
|
|
'email': 'bobby@tables.com',
|
2013-11-07 17:54:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SEND_RECOVERY_DETAILS = {
|
|
|
|
'email': 'jacob.moshenko@gmail.com',
|
|
|
|
}
|
|
|
|
|
|
|
|
SIGNIN_DETAILS = {
|
|
|
|
'username': 'devtable',
|
|
|
|
'password': 'password',
|
|
|
|
}
|
|
|
|
|
|
|
|
FILE_DROP_DETAILS = {
|
|
|
|
'mimeType': 'application/zip',
|
|
|
|
}
|
|
|
|
|
|
|
|
CHANGE_PERMISSION_DETAILS = {
|
|
|
|
'role': 'admin',
|
|
|
|
}
|
|
|
|
|
|
|
|
CREATE_BUILD_DETAILS = {
|
|
|
|
'file_id': str(uuid4()),
|
|
|
|
}
|
|
|
|
|
|
|
|
CHANGE_VISIBILITY_DETAILS = {
|
|
|
|
'visibility': 'public',
|
|
|
|
}
|
|
|
|
|
|
|
|
CREATE_TOKEN_DETAILS = {
|
|
|
|
'friendlyName': 'A new token',
|
|
|
|
}
|
|
|
|
|
|
|
|
UPDATE_REPO_DETAILS = {
|
|
|
|
'description': 'A new description',
|
|
|
|
}
|
|
|
|
|
2014-03-11 18:30:00 +00:00
|
|
|
FAKE_TRIGGER_CONFIG = {
|
|
|
|
'active': True
|
|
|
|
}
|
2013-11-07 17:54:44 +00:00
|
|
|
|
|
|
|
class TestSpec(object):
|
|
|
|
def __init__(self, url, anon_code=401, no_access_code=403, read_code=403,
|
|
|
|
admin_code=200):
|
|
|
|
self._url = url
|
|
|
|
self._data = None
|
|
|
|
self._method = 'GET'
|
|
|
|
|
|
|
|
self.anon_code = anon_code
|
|
|
|
self.no_access_code = no_access_code
|
|
|
|
self.read_code = read_code
|
|
|
|
self.admin_code = admin_code
|
|
|
|
|
|
|
|
def set_data_from_obj(self, json_serializable):
|
|
|
|
self._data = json.dumps(json_serializable)
|
|
|
|
return self
|
|
|
|
|
|
|
|
def set_method(self, method):
|
|
|
|
self._method = method
|
|
|
|
return self
|
|
|
|
|
|
|
|
def get_client_args(self):
|
|
|
|
kwargs = {
|
|
|
|
'method': self._method
|
|
|
|
}
|
|
|
|
|
|
|
|
if self._data or self._method == 'POST' or self._method == 'PUT':
|
|
|
|
kwargs['data'] = self._data if self._data else '{}'
|
|
|
|
kwargs['content_type'] = 'application/json'
|
|
|
|
|
|
|
|
return self._url, kwargs
|
|
|
|
|
|
|
|
|
|
|
|
def build_specs():
|
|
|
|
return [
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.welcome'), 200, 200, 200, 200),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_plans'), 200, 200, 200, 200),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_logged_in_user'), 200, 200, 200, 200),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.change_user_details'),
|
2013-11-07 18:19:20 +00:00
|
|
|
401, 200, 200, 200).set_method('PUT'),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.create_new_user'), 201, 201, 201,
|
2013-11-07 18:19:20 +00:00
|
|
|
201).set_method('POST').set_data_from_obj(NEW_USER_DETAILS),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.signin_user'), 200, 200, 200,
|
2013-11-07 18:19:20 +00:00
|
|
|
200).set_method('POST').set_data_from_obj(SIGNIN_DETAILS),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.request_recovery_email'), 201, 201, 201,
|
2013-11-07 18:19:20 +00:00
|
|
|
201).set_method('POST').set_data_from_obj(SEND_RECOVERY_DETAILS),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_matching_users', prefix='dev'),
|
|
|
|
401, 200, 200, 200),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_matching_entities', prefix='dev'), 401, 200, 200,
|
2013-11-07 18:19:20 +00:00
|
|
|
200),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_organization', orgname=ORG), 401, 403, 200, 200),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_organization_private_allowed', orgname=ORG)),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.update_organization_team', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS)).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.update_organization_team', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS)).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_organization_team', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_organization_team', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS),
|
|
|
|
admin_code=204).set_method('DELETE'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_organization_team_members', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_organization_team_members', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS), read_code=200),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.update_organization_team_member', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS, membername=ORG_OWNER),
|
|
|
|
admin_code=400).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.update_organization_team_member', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS,
|
|
|
|
membername=ORG_OWNER)).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_organization_team_member', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS, membername=ORG_OWNER),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_organization_team_member', orgname=ORG,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS, membername=ORG_OWNER),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.create_repo'))
|
2013-11-07 18:19:20 +00:00
|
|
|
.set_method('POST')
|
|
|
|
.set_data_from_obj(NEW_ORG_REPO_DETAILS)),
|
2013-11-06 22:56:31 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.find_repos'), 200, 200, 200, 200),
|
2013-11-06 22:56:31 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repos'), 200, 200, 200, 200),
|
2013-11-06 22:56:31 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.update_repo', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=403).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.update_repo', repository=ORG_REPO))
|
2013-11-07 18:19:20 +00:00
|
|
|
.set_method('PUT')
|
|
|
|
.set_data_from_obj(UPDATE_REPO_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.update_repo', repository=PRIVATE_REPO))
|
2013-11-07 18:19:20 +00:00
|
|
|
.set_method('PUT')
|
|
|
|
.set_data_from_obj(UPDATE_REPO_DETAILS)),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_repo_visibility', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=403).set_method('POST')
|
|
|
|
.set_data_from_obj(CHANGE_VISIBILITY_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_repo_visibility', repository=ORG_REPO))
|
2013-11-07 18:19:20 +00:00
|
|
|
.set_method('POST').set_data_from_obj(CHANGE_VISIBILITY_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_repo_visibility', repository=PRIVATE_REPO))
|
2013-11-07 18:19:20 +00:00
|
|
|
.set_method('POST').set_data_from_obj(CHANGE_VISIBILITY_DETAILS)),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_repository', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=403).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_repository', repository=ORG_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=204).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_repository', repository=PRIVATE_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=204).set_method('DELETE'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_repo', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
200, 200, 200,200),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_repo', repository=ORG_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
403, 403, 200, 200),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_repo', repository=PRIVATE_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
403, 403, 200, 200),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_repo_builds', repository=PUBLIC_REPO),
|
2014-01-31 00:36:21 +00:00
|
|
|
200, 200, 200, 200),
|
|
|
|
TestSpec(url_for('api.get_repo_builds', repository=ORG_REPO),
|
|
|
|
403, 403, 200, 200),
|
|
|
|
TestSpec(url_for('api.get_repo_builds', repository=PRIVATE_REPO),
|
|
|
|
403, 403, 200, 200),
|
2013-11-06 22:56:31 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_filedrop_url'), 401, 200, 200,
|
2013-11-07 18:19:20 +00:00
|
|
|
200).set_method('POST').set_data_from_obj(FILE_DROP_DETAILS),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.request_repo_build', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=403).set_method('POST')
|
|
|
|
.set_data_from_obj(CREATE_BUILD_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.request_repo_build', repository=ORG_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=201).set_method('POST')
|
|
|
|
.set_data_from_obj(CREATE_BUILD_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.request_repo_build', repository=PRIVATE_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=201).set_method('POST')
|
|
|
|
.set_data_from_obj(CREATE_BUILD_DETAILS)),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.create_webhook', repository=PUBLIC_REPO),
|
2013-12-02 20:40:12 +00:00
|
|
|
admin_code=403).set_method('POST'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.create_webhook',
|
2013-12-02 20:40:12 +00:00
|
|
|
repository=ORG_REPO)).set_method('POST'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.create_webhook',
|
2013-12-02 20:40:12 +00:00
|
|
|
repository=PRIVATE_REPO)).set_method('POST'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_webhook', repository=PUBLIC_REPO,
|
2013-12-02 20:40:12 +00:00
|
|
|
public_id=FAKE_WEBHOOK), admin_code=403),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_webhook', repository=ORG_REPO,
|
2014-02-03 23:30:06 +00:00
|
|
|
public_id=FAKE_WEBHOOK), admin_code=404),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_webhook', repository=PRIVATE_REPO,
|
2014-02-03 23:30:06 +00:00
|
|
|
public_id=FAKE_WEBHOOK), admin_code=404),
|
2013-12-02 20:40:12 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_webhooks', repository=PUBLIC_REPO),
|
|
|
|
admin_code=403),
|
|
|
|
TestSpec(url_for('api.list_webhooks', repository=ORG_REPO)),
|
|
|
|
TestSpec(url_for('api.list_webhooks', repository=PRIVATE_REPO)),
|
2013-12-02 20:40:12 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_webhook', repository=PUBLIC_REPO,
|
2013-12-02 20:40:12 +00:00
|
|
|
public_id=FAKE_WEBHOOK),
|
|
|
|
admin_code=403).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_webhook', repository=ORG_REPO,
|
2013-12-02 20:40:12 +00:00
|
|
|
public_id=FAKE_WEBHOOK),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_webhook', repository=PRIVATE_REPO,
|
2013-12-02 20:40:12 +00:00
|
|
|
public_id=FAKE_WEBHOOK),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repository_images', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
200, 200, 200, 200),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repository_images', repository=ORG_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
403, 403, 200, 200),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repository_images', repository=PRIVATE_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
403, 403, 200, 200),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_image', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
image_id=FAKE_IMAGE_ID), 404, 404, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_image', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
image_id=FAKE_IMAGE_ID), 403, 403, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_image', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
image_id=FAKE_IMAGE_ID), 403, 403, 404, 404),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_image_changes', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
image_id=FAKE_IMAGE_ID), 404, 404, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_image_changes', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
image_id=FAKE_IMAGE_ID), 403, 403, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_image_changes', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
image_id=FAKE_IMAGE_ID), 403, 403, 404, 404),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_tag_images', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
tag=FAKE_TAG_NAME), 404, 404, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_tag_images', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
tag=FAKE_TAG_NAME), 403, 403, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_tag_images', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
tag=FAKE_TAG_NAME), 403, 403, 404, 404),
|
2013-11-07 04:21:12 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repo_team_permissions', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=403),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repo_team_permissions', repository=ORG_REPO)),
|
|
|
|
TestSpec(url_for('api.list_repo_team_permissions',
|
|
|
|
repository=PRIVATE_REPO)),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repo_user_permissions', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=403),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repo_user_permissions', repository=ORG_REPO)),
|
|
|
|
TestSpec(url_for('api.list_repo_user_permissions',
|
|
|
|
repository=PRIVATE_REPO)),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_user_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME), admin_code=403),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_user_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME), admin_code=400),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_user_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME), admin_code=400),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_team_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS), admin_code=403),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_team_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS), admin_code=403),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_team_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS), admin_code=400),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_team_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_team_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS), admin_code=400),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_team_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS), admin_code=400),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.change_user_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME),
|
|
|
|
admin_code=403).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.change_user_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME),
|
|
|
|
admin_code=400).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.change_user_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME),
|
|
|
|
admin_code=400).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_team_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS), admin_code=403)
|
|
|
|
.set_method('PUT')
|
|
|
|
.set_data_from_obj(CHANGE_PERMISSION_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_team_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS), admin_code=403)
|
|
|
|
.set_method('PUT')
|
|
|
|
.set_data_from_obj(CHANGE_PERMISSION_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_team_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS))
|
|
|
|
.set_method('PUT')
|
|
|
|
.set_data_from_obj(CHANGE_PERMISSION_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_team_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS))
|
|
|
|
.set_method('PUT')
|
|
|
|
.set_data_from_obj(CHANGE_PERMISSION_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_team_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS), admin_code=400)
|
|
|
|
.set_method('PUT')
|
|
|
|
.set_data_from_obj(CHANGE_PERMISSION_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.change_team_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS), admin_code=400)
|
|
|
|
.set_method('PUT')
|
|
|
|
.set_data_from_obj(CHANGE_PERMISSION_DETAILS)),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_user_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME),
|
|
|
|
admin_code=403).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_user_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_user_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
username=FAKE_USERNAME),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_team_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS),
|
|
|
|
admin_code=403).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_team_permissions', repository=PUBLIC_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS),
|
|
|
|
admin_code=403).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_team_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_team_permissions', repository=ORG_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS),
|
|
|
|
admin_code=204).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_team_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_OWNERS),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_team_permissions', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
teamname=ORG_READERS),
|
|
|
|
admin_code=400).set_method('DELETE'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repo_tokens', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=403),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repo_tokens', repository=ORG_REPO)),
|
|
|
|
TestSpec(url_for('api.list_repo_tokens', repository=PRIVATE_REPO)),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_tokens', repository=PUBLIC_REPO,
|
|
|
|
code=FAKE_TOKEN), admin_code=403),
|
|
|
|
TestSpec(url_for('api.get_tokens', repository=ORG_REPO, code=FAKE_TOKEN),
|
2014-02-03 23:30:06 +00:00
|
|
|
admin_code=404),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_tokens', repository=PRIVATE_REPO,
|
2014-02-03 23:30:06 +00:00
|
|
|
code=FAKE_TOKEN), admin_code=404),
|
2013-11-07 18:19:20 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.create_token', repository=PUBLIC_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=403).set_method('POST'),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.create_token', repository=ORG_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=201).set_method('POST')
|
|
|
|
.set_data_from_obj(CREATE_TOKEN_DETAILS)),
|
2014-01-31 00:06:26 +00:00
|
|
|
(TestSpec(url_for('api.create_token', repository=PRIVATE_REPO),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=201).set_method('POST')
|
|
|
|
.set_data_from_obj(CREATE_TOKEN_DETAILS)),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.change_token', repository=PUBLIC_REPO,
|
|
|
|
code=FAKE_TOKEN), admin_code=403).set_method('PUT'),
|
|
|
|
TestSpec(url_for('api.change_token', repository=ORG_REPO, code=FAKE_TOKEN),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=400).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.change_token', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
code=FAKE_TOKEN), admin_code=400).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_token', repository=PUBLIC_REPO,
|
|
|
|
code=FAKE_TOKEN), admin_code=403).set_method('DELETE'),
|
|
|
|
TestSpec(url_for('api.delete_token', repository=ORG_REPO, code=FAKE_TOKEN),
|
2013-11-07 18:19:20 +00:00
|
|
|
admin_code=400).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.delete_token', repository=PRIVATE_REPO,
|
2013-11-07 18:19:20 +00:00
|
|
|
code=FAKE_TOKEN), admin_code=400).set_method('DELETE'),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.update_user_subscription'),
|
|
|
|
401, 400, 400, 400).set_method('PUT'),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.update_org_subscription', orgname=ORG),
|
2013-11-07 18:19:20 +00:00
|
|
|
401, 403, 403, 400).set_method('PUT'),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_user_subscription'), 401, 200, 200, 200),
|
2013-11-07 17:54:44 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.get_org_subscription', orgname=ORG)),
|
2013-12-02 20:36:39 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_repo_logs', repository=PUBLIC_REPO),
|
|
|
|
admin_code=403),
|
|
|
|
TestSpec(url_for('api.list_repo_logs', repository=ORG_REPO)),
|
|
|
|
TestSpec(url_for('api.list_repo_logs', repository=PRIVATE_REPO)),
|
2013-12-02 20:36:39 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
TestSpec(url_for('api.list_org_logs', orgname=ORG)),
|
2014-02-26 18:45:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
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),
|
|
|
|
|
2014-03-11 18:30:00 +00:00
|
|
|
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),
|
2014-02-26 18:45:49 +00:00
|
|
|
|
2014-03-11 18:30:00 +00:00
|
|
|
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),
|
2014-02-26 18:45:49 +00:00
|
|
|
|
|
|
|
TestSpec(url_for('api.manually_start_build_trigger',
|
|
|
|
repository=PUBLIC_REPO, trigger_uuid=TRIGGER_UUID),
|
2014-03-11 18:30:00 +00:00
|
|
|
401, 403, 403, 403).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
2014-02-26 18:45:49 +00:00
|
|
|
TestSpec(url_for('api.manually_start_build_trigger',
|
|
|
|
repository=ORG_REPO, trigger_uuid=TRIGGER_UUID),
|
2014-03-11 18:30:00 +00:00
|
|
|
401, 403, 403, 404).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
2014-02-26 18:45:49 +00:00
|
|
|
TestSpec(url_for('api.manually_start_build_trigger',
|
|
|
|
repository=PRIVATE_REPO, trigger_uuid=TRIGGER_UUID),
|
2014-03-11 18:30:00 +00:00
|
|
|
401, 403, 403, 404).set_method('POST').set_data_from_obj(FAKE_TRIGGER_CONFIG),
|
2014-02-26 18:45:49 +00:00
|
|
|
|
|
|
|
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),
|
2013-11-07 17:54:44 +00:00
|
|
|
]
|
2013-11-07 22:10:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
class IndexTestSpec(object):
|
|
|
|
def __init__(self, url, sess_repo=None, anon_code=403, no_access_code=403,
|
|
|
|
read_code=200, admin_code=200):
|
|
|
|
self._url = url
|
|
|
|
self._method = 'GET'
|
|
|
|
self._data = None
|
|
|
|
|
|
|
|
self.sess_repo = sess_repo
|
|
|
|
|
|
|
|
self.anon_code = anon_code
|
|
|
|
self.no_access_code = no_access_code
|
|
|
|
self.read_code = read_code
|
|
|
|
self.admin_code = admin_code
|
|
|
|
|
|
|
|
def gen_basic_auth(self, username, password):
|
|
|
|
encoded = b64encode('%s:%s' % (username, password))
|
|
|
|
return 'basic %s' % encoded
|
|
|
|
|
|
|
|
def set_data_from_obj(self, json_serializable):
|
|
|
|
self._data = json.dumps(json_serializable)
|
|
|
|
return self
|
|
|
|
|
|
|
|
def set_method(self, method):
|
|
|
|
self._method = method
|
|
|
|
return self
|
|
|
|
|
|
|
|
def get_client_args(self):
|
|
|
|
kwargs = {
|
|
|
|
'method': self._method
|
|
|
|
}
|
|
|
|
|
|
|
|
if self._data or self._method == 'POST' or self._method == 'PUT':
|
|
|
|
kwargs['data'] = self._data if self._data else '{}'
|
|
|
|
kwargs['content_type'] = 'application/json'
|
|
|
|
|
|
|
|
return self._url, kwargs
|
|
|
|
|
|
|
|
|
|
|
|
def build_index_specs():
|
|
|
|
return [
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_layer', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PUBLIC_REPO, 200, 200, 200, 200),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_layer', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PRIVATE_REPO),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_layer', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
ORG_REPO),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_layer', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PUBLIC_REPO, 403, 403, 403, 403).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_layer', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PRIVATE_REPO, 403, 403, 403, 404).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_layer', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
ORG_REPO, 403, 403, 403, 404).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_checksum',
|
|
|
|
image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PUBLIC_REPO, 403, 403, 403, 403).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_checksum',
|
|
|
|
image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PRIVATE_REPO, 403, 403, 403, 400).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_checksum',
|
|
|
|
image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
ORG_REPO, 403, 403, 403, 400).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_json', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PUBLIC_REPO, 404, 404, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_json', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PRIVATE_REPO, 403, 403, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_json', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
ORG_REPO, 403, 403, 404, 404),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_ancestry',
|
|
|
|
image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PUBLIC_REPO, 404, 404, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_ancestry',
|
|
|
|
image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PRIVATE_REPO, 403, 403, 404, 404),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.get_image_ancestry',
|
|
|
|
image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
ORG_REPO, 403, 403, 404, 404),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_json', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PUBLIC_REPO, 403, 403, 403, 403).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_json', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
PRIVATE_REPO, 403, 403, 403, 400).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('registry.put_image_json', image_id=FAKE_IMAGE_ID),
|
2013-11-07 22:10:57 +00:00
|
|
|
ORG_REPO, 403, 403, 403, 400).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.create_user'), NO_REPO, 201, 201, 201,
|
2013-11-07 22:10:57 +00:00
|
|
|
201).set_method('POST').set_data_from_obj(NEW_USER_DETAILS),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.get_user'), NO_REPO, 404, 200, 200, 200),
|
2013-11-07 22:10:57 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.update_user', username=FAKE_USERNAME),
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO, 403, 403, 403, 403).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.create_repository', repository=PUBLIC_REPO),
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO, 403, 403, 403, 403).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.create_repository', repository=PRIVATE_REPO),
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO, 403, 403, 403, 201).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.create_repository', repository=ORG_REPO),
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO, 403, 403, 403, 201).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.update_images', repository=PUBLIC_REPO),
|
|
|
|
NO_REPO, 403, 403, 403, 403).set_method('PUT'),
|
|
|
|
IndexTestSpec(url_for('index.update_images', repository=PRIVATE_REPO),
|
|
|
|
NO_REPO, 403, 403, 403, 204).set_method('PUT'),
|
|
|
|
IndexTestSpec(url_for('index.update_images', repository=ORG_REPO), NO_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
403, 403, 403, 204).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.get_repository_images',
|
|
|
|
repository=PUBLIC_REPO),
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO, 200, 200, 200, 200),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.get_repository_images',
|
|
|
|
repository=PRIVATE_REPO)),
|
|
|
|
IndexTestSpec(url_for('index.get_repository_images', repository=ORG_REPO)),
|
2013-11-07 22:10:57 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.delete_repository_images',
|
|
|
|
repository=PUBLIC_REPO),
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO, 501, 501, 501, 501).set_method('DELETE'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.put_repository_auth', repository=PUBLIC_REPO),
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO, 501, 501, 501, 501).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.get_search'), NO_REPO, 501, 501, 501, 501),
|
2013-11-07 22:10:57 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('index.ping'), NO_REPO, 200, 200, 200, 200),
|
2013-11-07 22:10:57 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.get_tags', repository=PUBLIC_REPO), NO_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
200, 200, 200, 200),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.get_tags', repository=PRIVATE_REPO)),
|
|
|
|
IndexTestSpec(url_for('tags.get_tags', repository=ORG_REPO)),
|
2013-11-07 22:10:57 +00:00
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.get_tag', repository=PUBLIC_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
tag=FAKE_TAG_NAME), NO_REPO, 400, 400, 400, 400),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.get_tag', repository=PRIVATE_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
tag=FAKE_TAG_NAME), NO_REPO, 403, 403, 400, 400),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.get_tag', repository=ORG_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
tag=FAKE_TAG_NAME), NO_REPO, 403, 403, 400, 400),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.put_tag', repository=PUBLIC_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
tag=FAKE_TAG_NAME),
|
|
|
|
NO_REPO, 403, 403, 403, 403).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.put_tag', repository=PRIVATE_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
tag=FAKE_TAG_NAME),
|
|
|
|
NO_REPO, 403, 403, 403, 400).set_method('PUT'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.put_tag', repository=ORG_REPO,
|
|
|
|
tag=FAKE_TAG_NAME),
|
2013-11-07 22:10:57 +00:00
|
|
|
NO_REPO, 403, 403, 403, 400).set_method('PUT'),
|
|
|
|
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.delete_tag', repository=PUBLIC_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
tag=FAKE_TAG_NAME),
|
|
|
|
NO_REPO, 403, 403, 403, 403).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.delete_tag', repository=PRIVATE_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
tag=FAKE_TAG_NAME),
|
|
|
|
NO_REPO, 403, 403, 403, 400).set_method('DELETE'),
|
2014-01-31 00:06:26 +00:00
|
|
|
IndexTestSpec(url_for('tags.delete_tag', repository=ORG_REPO,
|
2013-11-07 22:10:57 +00:00
|
|
|
tag=FAKE_TAG_NAME),
|
|
|
|
NO_REPO, 403, 403, 403, 400).set_method('DELETE'),
|
2013-12-02 20:36:39 +00:00
|
|
|
]
|