summaryrefslogtreecommitdiff
path: root/glanceclient/tests
diff options
context:
space:
mode:
authorimacdonn <iain.macdonnell@oracle.com>2018-09-14 23:25:11 +0000
committerimacdonn <iain.macdonnell@oracle.com>2018-10-24 00:16:58 +0000
commit3f7171dc1445f0647f15a735e5f4b55a986068e6 (patch)
treeac9abeeb7cdefd1fbc2d84473e87f7856045126f /glanceclient/tests
parenta757757a106d9ed6c06e5a2f38ed27e77d2221f5 (diff)
downloadpython-glanceclient-3f7171dc1445f0647f15a735e5f4b55a986068e6.tar.gz
Embed validation data when adding location
Add support for embedding of checksum, os_hash_algo and os_hash_value when adding a location to an image. Depends-On: https://review.openstack.org/597648 Change-Id: Ibbe2f2bb226f52cc6b2ab591913b1797d2b086c0
Diffstat (limited to 'glanceclient/tests')
-rw-r--r--glanceclient/tests/unit/v2/test_shell_v2.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/glanceclient/tests/unit/v2/test_shell_v2.py b/glanceclient/tests/unit/v2/test_shell_v2.py
index 6eeca83..a5b0a9b 100644
--- a/glanceclient/tests/unit/v2/test_shell_v2.py
+++ b/glanceclient/tests/unit/v2/test_shell_v2.py
@@ -1428,18 +1428,25 @@ class ShellV2Test(testtools.TestCase):
def test_do_location_add(self):
gc = self.gc
- loc = {'url': 'http://foo.com/', 'metadata': {'foo': 'bar'}}
- args = self._make_args({'id': 'pass',
- 'url': loc['url'],
- 'metadata': json.dumps(loc['metadata'])})
+ loc = {'url': 'http://foo.com/',
+ 'metadata': {'foo': 'bar'},
+ 'validation_data': {'checksum': 'csum',
+ 'os_hash_algo': 'algo',
+ 'os_hash_value': 'value'}}
+ args = {'id': 'pass',
+ 'url': loc['url'],
+ 'metadata': json.dumps(loc['metadata']),
+ 'checksum': 'csum',
+ 'hash_algo': 'algo',
+ 'hash_value': 'value'}
with mock.patch.object(gc.images, 'add_location') as mocked_addloc:
expect_image = {'id': 'pass', 'locations': [loc]}
mocked_addloc.return_value = expect_image
- test_shell.do_location_add(self.gc, args)
- mocked_addloc.assert_called_once_with('pass',
- loc['url'],
- loc['metadata'])
+ test_shell.do_location_add(self.gc, self._make_args(args))
+ mocked_addloc.assert_called_once_with(
+ 'pass', loc['url'], loc['metadata'],
+ validation_data=loc['validation_data'])
utils.print_dict.assert_called_once_with(expect_image)
def test_do_location_delete(self):