Rename 'sample_artifact' to 'images' in tests

All 'sample_artifact' instances in tests are replaced with
'images' type, because 'sample_artifact' type doesn't exist.

Change-Id: Ie24e52b90be6f36abdcbcba008066a560f4e540e
This commit is contained in:
Mike Fedosin 2016-09-26 14:50:14 +03:00
parent b2dc01eea5
commit 82b85ec171
4 changed files with 134 additions and 135 deletions

View File

@ -38,7 +38,7 @@ class TestListArtifacts(TestArtifacts):
def setUp(self):
super(TestListArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.ListArtifacts(self.app, None)
@ -46,8 +46,8 @@ class TestListArtifacts(TestArtifacts):
'Owner', 'Visibility', 'Status']
def test_artifact_list(self):
arglist = ['sample_artifact']
verify = [('type_name', 'sample_artifact')]
arglist = ['images']
verify = [('type_name', 'images')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
@ -73,44 +73,44 @@ class TestListArtifacts(TestArtifacts):
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_with_multifilters(self):
arglist = ['sample_artifact',
arglist = ['images',
'--filter', 'spam:spam',
'--filter', 'maps:maps']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('filter', ['spam:spam', 'maps:maps'])]
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_with_sort(self):
arglist = ['sample_artifact', '--sort', 'name:asc']
verify = [('type_name', 'sample_artifact'),
arglist = ['images', '--sort', 'name:asc']
verify = [('type_name', 'images'),
('sort', 'name:asc')]
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_with_multisort(self):
arglist = ['sample_artifact',
arglist = ['images',
'--sort', 'name:desc',
'--sort', 'name:asc']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('sort', 'name:asc')]
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_page_size(self):
arglist = ['sample_artifact', '--page-size', '1']
verify = [('type_name', 'sample_artifact'),
arglist = ['images', '--page-size', '1']
verify = [('type_name', 'images'),
('page_size', '1')]
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_limit(self):
arglist = ['sample_artifact', '--limit', '2']
verify = [('type_name', 'sample_artifact'),
arglist = ['images', '--limit', '2']
verify = [('type_name', 'images'),
('limit', '2')]
self.check_parser(self.cmd, arglist, verify)
def test_artifact_list_multilimit(self):
arglist = ['sample_artifact', '--limit', '2', '--limit', '1']
verify = [('type_name', 'sample_artifact'),
arglist = ['images', '--limit', '2', '--limit', '1']
verify = [('type_name', 'images'),
('limit', '1')]
self.check_parser(self.cmd, arglist, verify)
@ -120,14 +120,14 @@ class TestShowArtifacts(TestArtifacts):
def setUp(self):
super(TestShowArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.ShowArtifact(self.app, None)
def test_artifact_show(self):
arglist = ['sample_artifact', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba']
verify = [('type_name', 'sample_artifact')]
arglist = ['images', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba']
verify = [('type_name', 'images')]
COLUMNS = set(['blob', 'environment', 'id', 'image',
'name', 'owner', 'package', 'status',
'template', 'version', 'visibility'])
@ -140,15 +140,15 @@ class TestShowArtifacts(TestArtifacts):
self.assertEqual(COLUMNS, name_fields)
def test_artifact_show_without_id(self):
arglist = ['sample_artifact']
verify = [('type_name', 'sample_artifact')]
arglist = ['images']
verify = [('type_name', 'images')]
with testtools.ExpectedException(ParserException):
self.check_parser(self.cmd, arglist, verify)
def test_artifact_show_without_type_id(self):
arglist = ['fc15c365-d4f9-4b8b-a090-d9e230f1f6ba']
verify = [('type_name', 'sample_artifact')]
verify = [('type_name', 'images')]
with testtools.ExpectedException(ParserException):
self.check_parser(self.cmd, arglist, verify)
@ -159,16 +159,16 @@ class TestCreateArtifacts(TestArtifacts):
def setUp(self):
super(TestCreateArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.CreateArtifact(self.app, None)
def test_create_artifact(self):
arglist = ['sample_artifact', 'art',
arglist = ['images', 'art',
'--artifact-version', '0.2.4',
'--property', 'blah=10']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('property', ['blah=10']),
('artifact_version', '0.2.4')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
@ -179,20 +179,20 @@ class TestCreateArtifacts(TestArtifacts):
self.assertEqual(self.COLUMNS, name_fields)
def test_create_artifact_multiproperty(self):
arglist = ['sample_artifact', 'art',
arglist = ['images', 'art',
'--artifact-version', '0.2.4',
'--property', 'blah=1',
'--property', 'blag=2']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('property', ['blah=1', 'blag=2']),
('artifact_version', '0.2.4')]
self.check_parser(self.cmd, arglist, verify)
def test_create_artifact_multiversion(self):
arglist = ['sample_artifact', 'art',
arglist = ['images', 'art',
'--artifact-version', '0.2.4',
'--artifact-version', '0.2.5']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('artifact_version', '0.2.5')]
self.check_parser(self.cmd, arglist, verify)
@ -202,17 +202,17 @@ class TestUpdateArtifacts(TestArtifacts):
def setUp(self):
super(TestUpdateArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.UpdateArtifact(self.app, None)
def test_artifact_update(self):
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba',
'--property', 'blah=1',
'--property', 'blag=2']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('property', ['blah=1', 'blag=2'])]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)
@ -222,22 +222,22 @@ class TestUpdateArtifacts(TestArtifacts):
self.assertEqual(self.COLUMNS, name_fields)
def test_artifact_update_bad(self):
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba',
'--property', 'blah',
'--property', 'blah'
]
verify = [('type_name', 'sample_artifact')]
verify = [('type_name', 'images')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
with testtools.ExpectedException(ValueError):
self.cmd.take_action(parsed_args)
def test_artifact_update_multiremove_prop(self):
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba',
'--remove-property', 'prop1',
'--remove-property', 'prop2']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('remove_property', ['prop1', 'prop2'])]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)
@ -251,15 +251,15 @@ class TestDeleteArtifacts(TestArtifacts):
def setUp(self):
super(TestDeleteArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.DeleteArtifact(self.app, None)
def test_artifact_delete(self):
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('id', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
self.assertIsNone(self.cmd.take_action(parsed_args))
@ -270,15 +270,15 @@ class TestActivateArtifacts(TestArtifacts):
def setUp(self):
super(TestActivateArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.ActivateArtifact(self.app, None)
def test_artifact_activate(self):
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('id', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)
@ -293,15 +293,15 @@ class TestDeactivateArtifacts(TestArtifacts):
def setUp(self):
super(TestDeactivateArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.DeactivateArtifact(self.app, None)
def test_artifact_deactivate(self):
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('id', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)
@ -316,15 +316,15 @@ class TestReactivateArtifacts(TestArtifacts):
def setUp(self):
super(TestReactivateArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.ReactivateArtifact(self.app, None)
def test_artifact_rectivate(self):
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('id', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)
@ -339,15 +339,15 @@ class TestPublishArtifacts(TestArtifacts):
def setUp(self):
super(TestPublishArtifacts, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.PublishArtifact(self.app, None)
def test_publish_delete(self):
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba']
verify = [('type_name', 'sample_artifact'),
verify = [('type_name', 'images'),
('id', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)
@ -362,14 +362,14 @@ class TypeSchema(TestArtifacts):
def setUp(self):
super(TypeSchema, self).setUp()
self.artifact_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_art.TypeSchema(self.app, None)
def test_get_schema(self):
arglist = ['sample_artifact']
verify = [('type_name', 'sample_artifact')]
arglist = ['images']
verify = [('type_name', 'images')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)

View File

@ -32,7 +32,7 @@ class TestUploadBlob(TestBlobs):
def setUp(self):
super(TestUploadBlob, self).setUp()
self.blob_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_blob.UploadBlob(self.app, None)
@ -126,11 +126,10 @@ class TestUploadBlob(TestBlobs):
self.assertEqual(exp_data, data)
def test_upload_bad(self):
arglist = ['sample_artifact',
arglist = ['user_type',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba',
'--file', '/path/to/file']
verify = [('type_name', 'sample_artifact')]
verify = [('type_name', 'user_type')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
with testtools.ExpectedException(SystemExit):
self.cmd.take_action(parsed_args)
@ -174,11 +173,11 @@ class TestUploadBlob(TestBlobs):
'd8a7834fc6652f316322d80196f6dcf2'
'94417030e37c15412e4deb7a67a367dd',
594, 'active', 'fake_url')
arglist = ['sample_artifact',
arglist = ['images',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba',
'--file', '/path/to/file',
'--blob-property', 'blob']
verify = [('type_name', 'sample_artifact')]
verify = [('type_name', 'images')]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)
@ -190,7 +189,7 @@ class TestDownloadBlob(TestBlobs):
def setUp(self):
super(TestDownloadBlob, self).setUp()
self.blob_mock.call.return_value = \
api_art.Controller(self.http, type_name='sample_artifact')
api_art.Controller(self.http, type_name='images')
# Command to test
self.cmd = osc_blob.DownloadBlob(self.app, None)

View File

@ -15,12 +15,12 @@
data_fixtures = {
'/artifacts/sample_artifact?limit=20': {
'/artifacts/images?limit=20': {
'GET': (
# headers
{},
# response
{'sample_artifact': [
{'images': [
{
'name': 'art1',
'id': '3a4560a1-e585-443e-9b39-553b46ec92d1',
@ -39,10 +39,10 @@ data_fixtures = {
]},
),
},
'/artifacts/sample_artifact?page_size=2': {
'/artifacts/images?page_size=2': {
'GET': (
{},
{'sample_artifact': [
{'images': [
{
'name': 'art1',
'id': '3a4560a1-e585-443e-9b39-553b46ec92d1',
@ -56,10 +56,10 @@ data_fixtures = {
]},
),
},
'/artifacts/sample_artifact?limit=2': {
'/artifacts/images?limit=2': {
'GET': (
{},
{'sample_artifact': [
{'images': [
{
'name': 'art1',
'id': '3a4560a1-e585-443e-9b39-553b46ec92d1',
@ -70,15 +70,15 @@ data_fixtures = {
'id': 'db721fb0-5b85-4738-9401-f161d541de5e',
'version': '0.0.0'
}],
'next': '/artifacts/sample_artifact?'
'next': '/artifacts/images?'
'marker=e1090471-1d12-4935-a8d8-a9351266ece8&limit=2'},
),
},
'/artifacts/sample_artifact?'
'/artifacts/images?'
'limit=2&marker=e1090471-1d12-4935-a8d8-a9351266ece8': {
'GET': (
{},
{'sample_artifact': [
{'images': [
{
'name': 'art3',
'id': 'e1090471-1d12-4935-a8d8-a9351266ece8',
@ -87,10 +87,10 @@ data_fixtures = {
]},
),
},
'/artifacts/sample_artifact?limit=20&sort=name%3Adesc': {
'/artifacts/images?limit=20&sort=name%3Adesc': {
'GET': (
{},
{'sample_artifact': [
{'images': [
{
'name': 'art2',
'id': 'e4f027d2-bff3-4084-a2ba-f31cb5e3067f',
@ -102,14 +102,14 @@ data_fixtures = {
'version': '0.0.0'
}
],
'next': '/artifacts/sample_artifact?'
'next': '/artifacts/images?'
'marker=3a4560a1-e585-443e-9b39-553b46ec92d1&limit=20'},
),
},
'/artifacts/sample_artifact?limit=20&sort=name': {
'/artifacts/images?limit=20&sort=name': {
'GET': (
{},
{'sample_artifact': [
{'images': [
{
'name': 'art2',
'id': 'e4f027d2-bff3-4084-a2ba-f31cb5e3067f',
@ -121,15 +121,15 @@ data_fixtures = {
'version': '0.0.0'
}
],
'next': '/artifacts/sample_artifact?'
'next': '/artifacts/images?'
'marker=3a4560a1-e585-443e-9b39-553b46ec92d1&limit=20'},
),
},
'/artifacts/sample_artifact?'
'/artifacts/images?'
'limit=20&marker=3a4560a1-e585-443e-9b39-553b46ec92d1': {
'GET': (
{},
{'sample_artifact': [
{'images': [
{
'name': 'art1',
'id': '3a4560a1-e585-443e-9b39-553b46ec92d1',
@ -138,10 +138,10 @@ data_fixtures = {
]}
),
},
'/artifacts/sample_artifact': {
'/artifacts/images': {
'POST': (
{},
{'sample_artifact': [
{'images': [
{
'name': 'art_1',
'id': '3a4560a1-e585-443e-9b39-553b46ec92a3',
@ -150,7 +150,7 @@ data_fixtures = {
]}
),
},
'/artifacts/sample_artifact/3a4560a1-e585-443e-9b39-553b46ec92a3': {
'/artifacts/images/3a4560a1-e585-443e-9b39-553b46ec92a3': {
'DELETE': (
{},
{}
@ -161,7 +161,7 @@ data_fixtures = {
),
'GET': (
{},
{'sample_artifact': [
{'images': [
{
'name': 'art_1',
'id': '3a4560a1-e585-443e-9b39-553b46ec92a3',
@ -170,7 +170,7 @@ data_fixtures = {
]}
)
},
'/artifacts/sample_artifact/3a4560a1-e585-443e-9b39-553b46ec92a3/blob': {
'/artifacts/images/3a4560a1-e585-443e-9b39-553b46ec92a3/image': {
'PUT': (
{},
''
@ -180,7 +180,7 @@ data_fixtures = {
{}
)
},
'/artifacts/sample_artifact/3a4560a1-e585-443e-9b39-553b46ec92a2/blob': {
'/artifacts/images/3a4560a1-e585-443e-9b39-553b46ec92a2/image': {
'PUT': (
{},
''

View File

@ -28,7 +28,7 @@ class TestController(testtools.TestCase):
self.controller = artifacts.Controller(self.api)
def test_list_artifacts(self):
artifacts = list(self.controller.list(type_name='sample_artifact'))
artifacts = list(self.controller.list(type_name='images'))
self.assertEqual('3a4560a1-e585-443e-9b39-553b46ec92d1',
artifacts[0]['id'])
self.assertEqual('art1', artifacts[0]['name'])
@ -41,13 +41,13 @@ class TestController(testtools.TestCase):
exp_headers = {}
expect_body = None
expect = [('GET', '/artifacts/sample_artifact?limit=20',
expect = [('GET', '/artifacts/images?limit=20',
exp_headers,
expect_body)]
self.assertEqual(expect, self.api.calls)
def test_list_with_paginate(self):
artifacts = list(self.controller.list(type_name='sample_artifact',
artifacts = list(self.controller.list(type_name='images',
page_size=2))
self.assertEqual('3a4560a1-e585-443e-9b39-553b46ec92d1',
artifacts[0]['id'])
@ -57,17 +57,17 @@ class TestController(testtools.TestCase):
artifacts[1]['id'])
exp_headers = {}
expect_body = None
expect = [('GET', '/artifacts/sample_artifact?limit=2',
expect = [('GET', '/artifacts/images?limit=2',
exp_headers,
expect_body),
('GET', '/artifacts/sample_artifact?limit=2'
('GET', '/artifacts/images?limit=2'
'&marker=e1090471-1d12-4935-a8d8-a9351266ece8',
exp_headers,
expect_body)]
self.assertEqual(expect, self.api.calls)
def test_list_artifacts_limit(self):
artifacts = list(self.controller.list(type_name='sample_artifact',
artifacts = list(self.controller.list(type_name='images',
limit=2))
self.assertEqual('3a4560a1-e585-443e-9b39-553b46ec92d1',
artifacts[0]['id'])
@ -77,14 +77,14 @@ class TestController(testtools.TestCase):
artifacts[1]['id'])
exp_headers = {}
expect_body = None
expect = [('GET', '/artifacts/sample_artifact?limit=2',
expect = [('GET', '/artifacts/images?limit=2',
exp_headers,
expect_body)]
self.assertEqual(expect, self.api.calls)
def test_list_artifact_sort_name(self):
artifacts = list(self.controller.list(type_name='sample_artifact',
artifacts = list(self.controller.list(type_name='images',
sort='name:desc'))
self.assertEqual('e4f027d2-bff3-4084-a2ba-f31cb5e3067f',
artifacts[0]['id'])
@ -94,11 +94,11 @@ class TestController(testtools.TestCase):
artifacts[1]['id'])
exp_headers = {}
expect_body = None
expect = [('GET', '/artifacts/sample_artifact?limit=20'
expect = [('GET', '/artifacts/images?limit=20'
'&sort=name%3Adesc',
exp_headers,
expect_body),
('GET', '/artifacts/sample_artifact?limit=20'
('GET', '/artifacts/images?limit=20'
'&marker=3a4560a1-e585-443e-9b39-553b46ec92d1',
exp_headers,
expect_body)]
@ -106,22 +106,22 @@ class TestController(testtools.TestCase):
def test_list_artifact_sort_badrequest(self):
with testtools.ExpectedException(HTTPBadRequest):
list(self.controller.list(type_name='sample_artifact',
list(self.controller.list(type_name='images',
sort='name:KAK'))
def test_create_artifact(self):
properties = {
'name': 'art_1',
'type_name': 'sample_artifact'
'type_name': 'images'
}
art = self.controller.create(**properties)
self.assertEqual('art_1', art['sample_artifact'][0]['name'])
self.assertEqual('0.0.0', art['sample_artifact'][0]['version'])
self.assertIsNotNone(art['sample_artifact'][0]['id'])
self.assertEqual('art_1', art['images'][0]['name'])
self.assertEqual('0.0.0', art['images'][0]['version'])
self.assertIsNotNone(art['images'][0]['id'])
exp_headers = {}
expect_body = [('name', 'art_1'), ('version', '0.0.0')]
expect = [('POST', '/artifacts/sample_artifact',
expect = [('POST', '/artifacts/images',
exp_headers,
expect_body)]
self.assertEqual(expect, self.api.calls)
@ -137,9 +137,9 @@ class TestController(testtools.TestCase):
def test_delete_artifact(self):
self.controller.delete(
artifact_id='3a4560a1-e585-443e-9b39-553b46ec92a3',
type_name='sample_artifact')
type_name='images')
expect = [('DELETE', '/artifacts/sample_artifact/'
expect = [('DELETE', '/artifacts/images/'
'3a4560a1-e585-443e-9b39-553b46ec92a3',
{},
None)]
@ -147,7 +147,7 @@ class TestController(testtools.TestCase):
def test_update_prop(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
param = {'type_name': 'sample_artifact',
param = {'type_name': 'images',
'name': 'new_name'}
self.controller.update(artifact_id=art_id,
@ -161,7 +161,7 @@ class TestController(testtools.TestCase):
'value': 'new_name',
'op': 'add'}]
expect = [('PATCH', '/artifacts/sample_artifact/%s' % art_id,
expect = [('PATCH', '/artifacts/images/%s' % art_id,
exp_headers,
expect_body)]
@ -172,7 +172,7 @@ class TestController(testtools.TestCase):
self.controller.update(artifact_id=art_id,
remove_props=['name'],
type_name='sample_artifact')
type_name='images')
exp_headers = {
'Content-Type': 'application/json-patch+json'
}
@ -181,7 +181,7 @@ class TestController(testtools.TestCase):
'op': 'replace',
'value': None}]
expect = [('PATCH', '/artifacts/sample_artifact/%s' % art_id,
expect = [('PATCH', '/artifacts/images/%s' % art_id,
exp_headers,
expect_body)]
@ -190,12 +190,12 @@ class TestController(testtools.TestCase):
self.controller.update(artifact_id=art_id,
remove_props=['metadata/key1'],
type_name='sample_artifact')
type_name='images')
expect_body = [{'path': '/metadata/key1',
'op': 'remove'}]
expect = [('PATCH', '/artifacts/sample_artifact/%s' % art_id,
expect = [('PATCH', '/artifacts/images/%s' % art_id,
exp_headers,
expect_body)]
@ -204,12 +204,12 @@ class TestController(testtools.TestCase):
self.controller.update(artifact_id=art_id,
remove_props=['releases/1'],
type_name='sample_artifact')
type_name='images')
expect_body = [{'path': '/releases/1',
'op': 'remove'}]
expect = [('PATCH', '/artifacts/sample_artifact/%s' % art_id,
expect = [('PATCH', '/artifacts/images/%s' % art_id,
exp_headers,
expect_body)]
@ -222,7 +222,7 @@ class TestController(testtools.TestCase):
def test_active_artifact(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
self.controller.activate(artifact_id=art_id,
type_name='sample_artifact')
type_name='images')
exp_headers = {
'Content-Type': 'application/json-patch+json'
}
@ -231,7 +231,7 @@ class TestController(testtools.TestCase):
'value': 'active',
'op': 'add'}]
expect = [('PATCH', '/artifacts/sample_artifact/%s' % art_id,
expect = [('PATCH', '/artifacts/images/%s' % art_id,
exp_headers,
expect_body)]
@ -240,7 +240,7 @@ class TestController(testtools.TestCase):
def test_deactivate_artifact(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
self.controller.deactivate(artifact_id=art_id,
type_name='sample_artifact')
type_name='images')
exp_headers = {
'Content-Type': 'application/json-patch+json'
}
@ -249,7 +249,7 @@ class TestController(testtools.TestCase):
'value': 'deactivated',
'op': 'add'}]
expect = [('PATCH', '/artifacts/sample_artifact/%s' % art_id,
expect = [('PATCH', '/artifacts/images/%s' % art_id,
exp_headers,
expect_body)]
@ -258,7 +258,7 @@ class TestController(testtools.TestCase):
def test_reactivate_artifact(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
self.controller.reactivate(artifact_id=art_id,
type_name='sample_artifact')
type_name='images')
exp_headers = {
'Content-Type': 'application/json-patch+json'
}
@ -267,7 +267,7 @@ class TestController(testtools.TestCase):
'value': 'active',
'op': 'add'}]
expect = [('PATCH', '/artifacts/sample_artifact/%s' % art_id,
expect = [('PATCH', '/artifacts/images/%s' % art_id,
exp_headers,
expect_body)]
@ -276,7 +276,7 @@ class TestController(testtools.TestCase):
def test_publish_artifact(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
self.controller.publish(artifact_id=art_id,
type_name='sample_artifact')
type_name='images')
exp_headers = {
'Content-Type': 'application/json-patch+json'
}
@ -285,7 +285,7 @@ class TestController(testtools.TestCase):
'value': 'public',
'op': 'add'}]
expect = [('PATCH', '/artifacts/sample_artifact/%s' % art_id,
expect = [('PATCH', '/artifacts/images/%s' % art_id,
exp_headers,
expect_body)]
self.assertEqual(expect, self.api.calls)
@ -293,15 +293,15 @@ class TestController(testtools.TestCase):
def test_upload_blob(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
self.controller.upload_blob(artifact_id=art_id,
type_name='sample_artifact',
blob_property='blob',
type_name='images',
blob_property='image',
data='data')
exp_headers = {
'Content-Type': 'application/octet-stream'
}
expect = [('PUT', '/artifacts/sample_artifact/%s/blob' % art_id,
expect = [('PUT', '/artifacts/images/%s/image' % art_id,
exp_headers,
'data')]
self.assertEqual(expect, self.api.calls)
@ -309,8 +309,8 @@ class TestController(testtools.TestCase):
def test_upload_blob_custom_content_type(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
self.controller.upload_blob(artifact_id=art_id,
type_name='sample_artifact',
blob_property='blob',
type_name='images',
blob_property='image',
data='{"a":"b"}',
content_type='application/json',)
@ -318,7 +318,7 @@ class TestController(testtools.TestCase):
'Content-Type': 'application/json'
}
expect = [('PUT', '/artifacts/sample_artifact/%s/blob' % art_id,
expect = [('PUT', '/artifacts/images/%s/image' % art_id,
exp_headers,
{"a": "b"})]
self.assertEqual(expect, self.api.calls)
@ -326,12 +326,12 @@ class TestController(testtools.TestCase):
def test_download_blob(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
self.controller.download_blob(artifact_id=art_id,
type_name='sample_artifact',
blob_property='blob')
type_name='images',
blob_property='image')
exp_headers = {}
expect = [('GET', '/artifacts/sample_artifact/%s/blob' % art_id,
expect = [('GET', '/artifacts/images/%s/image' % art_id,
exp_headers,
None)]
self.assertEqual(expect, self.api.calls)
@ -339,11 +339,11 @@ class TestController(testtools.TestCase):
def test_download_blob_with_checksum(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a2'
data = self.controller.download_blob(artifact_id=art_id,
type_name='sample_artifact',
blob_property='blob')
type_name='images',
blob_property='image')
self.assertIsNotNone(data.iterable)
expect = [('GET', '/artifacts/sample_artifact/%s/blob' % art_id,
expect = [('GET', '/artifacts/images/%s/image' % art_id,
{},
None)]
self.assertEqual(expect, self.api.calls)
@ -351,12 +351,12 @@ class TestController(testtools.TestCase):
def test_download_blob_without_checksum(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a2'
data = self.controller.download_blob(artifact_id=art_id,
type_name='sample_artifact',
blob_property='blob',
type_name='images',
blob_property='image',
do_checksum=False)
self.assertIsNotNone(data.iterable)
expect = [('GET', '/artifacts/sample_artifact/%s/blob' % art_id,
expect = [('GET', '/artifacts/images/%s/image' % art_id,
{},
None)]
self.assertEqual(expect, self.api.calls)
@ -364,9 +364,9 @@ class TestController(testtools.TestCase):
def test_get_artifact(self):
art_id = '3a4560a1-e585-443e-9b39-553b46ec92a3'
art = self.controller.get(artifact_id=art_id,
type_name='sample_artifact')
self.assertEqual(art_id, art['sample_artifact'][0]['id'])
self.assertEqual('art_1', art['sample_artifact'][0]['name'])
type_name='images')
self.assertEqual(art_id, art['images'][0]['id'])
self.assertEqual('art_1', art['images'][0]['name'])
def test_type_list(self):
data = self.controller.get_type_list()