Merge "Change fixtures to use https"
This commit is contained in:
@@ -126,14 +126,14 @@ class RequestsMockTestCase(BaseTestCase):
|
||||
discovery_json),
|
||||
'r').read())
|
||||
self.adapter.post(
|
||||
'http://example.com/v2.0/tokens',
|
||||
'https://example.com/v2.0/tokens',
|
||||
text=open(
|
||||
os.path.join(
|
||||
self.fixtures_directory,
|
||||
'catalog.json'),
|
||||
'r').read())
|
||||
self.adapter.get(
|
||||
'http://image.example.com/',
|
||||
'https://image.example.com/',
|
||||
text=open(
|
||||
os.path.join(
|
||||
self.fixtures_directory,
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{
|
||||
"adminURL": "http://compute.example.com/v2.1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"adminURL": "https://compute.example.com/v2.1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"region": "RegionOne",
|
||||
"publicURL": "http://compute.example.com/v2.1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"internalURL": "http://compute.example.com/v2.1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"publicURL": "https://compute.example.com/v2.1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"internalURL": "https://compute.example.com/v2.1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"id": "32466f357f3545248c47471ca51b0d3a"
|
||||
}
|
||||
],
|
||||
@@ -33,10 +33,10 @@
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{
|
||||
"adminURL": "http://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"adminURL": "https://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"region": "RegionOne",
|
||||
"publicURL": "http://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"internalURL": "http://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"publicURL": "https://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"internalURL": "https://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"id": "1e875ca2225b408bbf3520a1b8e1a537"
|
||||
}
|
||||
],
|
||||
@@ -47,10 +47,10 @@
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{
|
||||
"adminURL": "http://image.example.com",
|
||||
"adminURL": "https://image.example.com",
|
||||
"region": "RegionOne",
|
||||
"publicURL": "http://image.example.com",
|
||||
"internalURL": "http://image.example.com",
|
||||
"publicURL": "https://image.example.com",
|
||||
"internalURL": "https://image.example.com",
|
||||
"id": "5a64de3c4a614d8d8f8d1ba3dee5f45f"
|
||||
}
|
||||
],
|
||||
@@ -61,10 +61,10 @@
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{
|
||||
"adminURL": "http://volume.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"adminURL": "https://volume.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"region": "RegionOne",
|
||||
"publicURL": "http://volume.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"internalURL": "http://volume.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"publicURL": "https://volume.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"internalURL": "https://volume.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"id": "3d15fdfc7d424f3c8923324417e1a3d1"
|
||||
}
|
||||
],
|
||||
@@ -75,10 +75,10 @@
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{
|
||||
"adminURL": "http://identity.example.com/v2.0",
|
||||
"adminURL": "https://identity.example.com/v2.0",
|
||||
"region": "RegionOne",
|
||||
"publicURL": "http://identity.example.comv2.0",
|
||||
"internalURL": "http://identity.example.comv2.0",
|
||||
"publicURL": "https://identity.example.comv2.0",
|
||||
"internalURL": "https://identity.example.comv2.0",
|
||||
"id": "4deb4d0504a044a395d4480741ba628c"
|
||||
}
|
||||
],
|
||||
@@ -89,10 +89,10 @@
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{
|
||||
"adminURL": "http://object-store.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"adminURL": "https://object-store.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"region": "RegionOne",
|
||||
"publicURL": "http://object-store.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"internalURL": "http://object-store.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"publicURL": "https://object-store.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"internalURL": "https://object-store.example.com/v1/1c36b64c840a42cd9e9b931a369337f0",
|
||||
"id": "4deb4d0504a044a395d4480741ba628c"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"id": "v3.6",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://example.com/v3/",
|
||||
"href": "https://example.com/v3/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -30,7 +30,7 @@
|
||||
"id": "v2.0",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://example.com/v2.0/",
|
||||
"href": "https://example.com/v2.0/",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"id": "v1.1",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v1/",
|
||||
"href": "http://image.example.com/v1/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -15,7 +15,7 @@
|
||||
"id": "v1.0",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v1/",
|
||||
"href": "http://image.example.com/v1/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"id": "v2.3",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v2/",
|
||||
"href": "http://image.example.com/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -15,7 +15,7 @@
|
||||
"id": "v2.2",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v2/",
|
||||
"href": "http://image.example.com/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -25,7 +25,7 @@
|
||||
"id": "v2.1",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v2/",
|
||||
"href": "http://image.example.com/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -35,7 +35,7 @@
|
||||
"id": "v2.0",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v2/",
|
||||
"href": "http://image.example.com/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"id": "v2.3",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v2/",
|
||||
"href": "http://image.example.com/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -15,7 +15,7 @@
|
||||
"id": "v2.2",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v2/",
|
||||
"href": "http://image.example.com/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -25,7 +25,7 @@
|
||||
"id": "v2.1",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v2/",
|
||||
"href": "http://image.example.com/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -35,7 +35,7 @@
|
||||
"id": "v2.0",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v2/",
|
||||
"href": "http://image.example.com/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -45,7 +45,7 @@
|
||||
"id": "v1.1",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v1/",
|
||||
"href": "http://image.example.com/v1/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
@@ -55,7 +55,7 @@
|
||||
"id": "v1.0",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://image.example.com/v1/",
|
||||
"href": "http://image.example.com/v1/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -74,7 +74,7 @@ class TestImage(base.RequestsMockTestCase):
|
||||
# We override the scheme of the endpoint with the scheme of the service
|
||||
# because glance has a bug where it doesn't return https properly.
|
||||
self.assertEqual(
|
||||
'http://image.example.com/v1/',
|
||||
'https://image.example.com/v1/',
|
||||
self.cloud._image_client.get_endpoint())
|
||||
self.assertEqual(
|
||||
'1', self.cloud_config.get_api_version('image'))
|
||||
@@ -84,7 +84,7 @@ class TestImage(base.RequestsMockTestCase):
|
||||
# We override the scheme of the endpoint with the scheme of the service
|
||||
# because glance has a bug where it doesn't return https properly.
|
||||
self.assertEqual(
|
||||
'http://image.example.com/v2/',
|
||||
'https://image.example.com/v2/',
|
||||
self.cloud._image_client.get_endpoint())
|
||||
self.assertEqual(
|
||||
'2', self.cloud_config.get_api_version('image'))
|
||||
@@ -101,7 +101,7 @@ class TestImage(base.RequestsMockTestCase):
|
||||
|
||||
def test_download_image_no_images_found(self):
|
||||
self.adapter.get(
|
||||
'http://image.example.com/v2/images',
|
||||
'https://image.example.com/v2/images',
|
||||
json=dict(images=[]))
|
||||
self.assertRaises(exc.OpenStackCloudResourceNotFound,
|
||||
self.cloud.download_image, 'fake_image',
|
||||
@@ -109,10 +109,10 @@ class TestImage(base.RequestsMockTestCase):
|
||||
|
||||
def _register_image_mocks(self):
|
||||
self.adapter.get(
|
||||
'http://image.example.com/v2/images',
|
||||
'https://image.example.com/v2/images',
|
||||
json=self.fake_search_return)
|
||||
self.adapter.get(
|
||||
'http://image.example.com/v2/images/{id}/file'.format(
|
||||
'https://image.example.com/v2/images/{id}/file'.format(
|
||||
id=self.image_id),
|
||||
content=self.output,
|
||||
headers={
|
||||
@@ -135,12 +135,12 @@ class TestImage(base.RequestsMockTestCase):
|
||||
|
||||
def test_empty_list_images(self):
|
||||
self.adapter.register_uri(
|
||||
'GET', 'http://image.example.com/v2/images', json={'images': []})
|
||||
'GET', 'https://image.example.com/v2/images', json={'images': []})
|
||||
self.assertEqual([], self.cloud.list_images())
|
||||
|
||||
def test_list_images(self):
|
||||
self.adapter.register_uri(
|
||||
'GET', 'http://image.example.com/v2/images',
|
||||
'GET', 'https://image.example.com/v2/images',
|
||||
json=self.fake_search_return)
|
||||
self.assertEqual(
|
||||
self.cloud._normalize_images([self.fake_image_dict]),
|
||||
@@ -150,16 +150,16 @@ class TestImage(base.RequestsMockTestCase):
|
||||
self.cloud.image_api_use_tasks = False
|
||||
|
||||
self.adapter.register_uri(
|
||||
'GET', 'http://image.example.com/v2/images', [
|
||||
'GET', 'https://image.example.com/v2/images', [
|
||||
dict(json={'images': []}),
|
||||
dict(json=self.fake_search_return),
|
||||
])
|
||||
self.adapter.register_uri(
|
||||
'POST', 'http://image.example.com/v2/images',
|
||||
'POST', 'https://image.example.com/v2/images',
|
||||
json=self.fake_image_dict,
|
||||
)
|
||||
self.adapter.register_uri(
|
||||
'PUT', 'http://image.example.com/v2/images/{id}/file'.format(
|
||||
'PUT', 'https://image.example.com/v2/images/{id}/file'.format(
|
||||
id=self.image_id),
|
||||
request_headers={'Content-Type': 'application/octet-stream'})
|
||||
|
||||
@@ -169,15 +169,15 @@ class TestImage(base.RequestsMockTestCase):
|
||||
|
||||
calls = [
|
||||
dict(method='GET', url='http://192.168.0.19:35357/'),
|
||||
dict(method='POST', url='http://example.com/v2.0/tokens'),
|
||||
dict(method='GET', url='http://image.example.com/'),
|
||||
dict(method='GET', url='http://image.example.com/v2/images'),
|
||||
dict(method='POST', url='http://image.example.com/v2/images'),
|
||||
dict(method='POST', url='https://example.com/v2.0/tokens'),
|
||||
dict(method='GET', url='https://image.example.com/'),
|
||||
dict(method='GET', url='https://image.example.com/v2/images'),
|
||||
dict(method='POST', url='https://image.example.com/v2/images'),
|
||||
dict(
|
||||
method='PUT',
|
||||
url='http://image.example.com/v2/images/{id}/file'.format(
|
||||
url='https://image.example.com/v2/images/{id}/file'.format(
|
||||
id=self.image_id)),
|
||||
dict(method='GET', url='http://image.example.com/v2/images'),
|
||||
dict(method='GET', url='https://image.example.com/v2/images'),
|
||||
]
|
||||
for x in range(0, len(calls)):
|
||||
self.assertEqual(
|
||||
@@ -206,7 +206,7 @@ class TestImage(base.RequestsMockTestCase):
|
||||
self.cloud.image_api_use_tasks = True
|
||||
|
||||
self.adapter.get(
|
||||
'http://object-store.example.com/info',
|
||||
'https://object-store.example.com/info',
|
||||
json=dict(
|
||||
swift={'max_file_size': 1000},
|
||||
slo={'min_segment_size': 500}))
|
||||
@@ -607,7 +607,7 @@ class TestImageV1Only(base.RequestsMockTestCase):
|
||||
# We override the scheme of the endpoint with the scheme of the service
|
||||
# because glance has a bug where it doesn't return https properly.
|
||||
self.assertEqual(
|
||||
'http://image.example.com/v1/',
|
||||
'https://image.example.com/v1/',
|
||||
self.cloud._image_client.get_endpoint())
|
||||
self.assertEqual(
|
||||
'1', self.cloud_config.get_api_version('image'))
|
||||
@@ -617,7 +617,7 @@ class TestImageV1Only(base.RequestsMockTestCase):
|
||||
# We override the scheme of the endpoint with the scheme of the service
|
||||
# because glance has a bug where it doesn't return https properly.
|
||||
self.assertEqual(
|
||||
'http://image.example.com/v1/',
|
||||
'https://image.example.com/v1/',
|
||||
self.cloud._image_client.get_endpoint())
|
||||
self.assertEqual(
|
||||
'1', self.cloud_config.get_api_version('image'))
|
||||
@@ -634,7 +634,7 @@ class TestImageV2Only(base.RequestsMockTestCase):
|
||||
# We override the scheme of the endpoint with the scheme of the service
|
||||
# because glance has a bug where it doesn't return https properly.
|
||||
self.assertEqual(
|
||||
'http://image.example.com/v2/',
|
||||
'https://image.example.com/v2/',
|
||||
self.cloud._image_client.get_endpoint())
|
||||
self.assertEqual(
|
||||
'2', self.cloud_config.get_api_version('image'))
|
||||
@@ -644,7 +644,7 @@ class TestImageV2Only(base.RequestsMockTestCase):
|
||||
# We override the scheme of the endpoint with the scheme of the service
|
||||
# because glance has a bug where it doesn't return https properly.
|
||||
self.assertEqual(
|
||||
'http://image.example.com/v2/',
|
||||
'https://image.example.com/v2/',
|
||||
self.cloud._image_client.get_endpoint())
|
||||
self.assertEqual(
|
||||
'2', self.cloud_config.get_api_version('image'))
|
||||
|
||||
@@ -315,7 +315,7 @@ class TestRESTObject(base.RequestsMockTestCase):
|
||||
|
||||
def test_get_object_segment_size(self):
|
||||
self.adapter.get(
|
||||
'http://object-store.example.com/info',
|
||||
'https://object-store.example.com/info',
|
||||
json=dict(
|
||||
swift={'max_file_size': 1000},
|
||||
slo={'min_segment_size': 500}))
|
||||
@@ -326,7 +326,7 @@ class TestRESTObject(base.RequestsMockTestCase):
|
||||
|
||||
def test_get_object_segment_size_http_404(self):
|
||||
self.adapter.get(
|
||||
'http://object-store.example.com/info',
|
||||
'https://object-store.example.com/info',
|
||||
status_code=404,
|
||||
reason='Not Found')
|
||||
self.assertEqual(shade.openstackcloud.DEFAULT_OBJECT_SEGMENT_SIZE,
|
||||
@@ -334,7 +334,7 @@ class TestRESTObject(base.RequestsMockTestCase):
|
||||
|
||||
def test_get_object_segment_size_http_412(self):
|
||||
self.adapter.get(
|
||||
'http://object-store.example.com/info',
|
||||
'https://object-store.example.com/info',
|
||||
status_code=412,
|
||||
reason='Precondition failed')
|
||||
self.assertEqual(shade.openstackcloud.DEFAULT_OBJECT_SEGMENT_SIZE,
|
||||
|
||||
Reference in New Issue
Block a user