Example #1
0
 def test_index_no_data(self):
     db.share_metadata_update(
         self.ctxt, self.share_id, {}, delete=True)
     req = fakes.HTTPRequest.blank(self.url)
     res_dict = self.controller.index(req, self.share_id)
     expected = {'metadata': {}}
     self.assertEqual(expected, res_dict)
Example #2
0
 def test_share_metadata_update_delete(self):
     metadata1 = {"a": "1", "c": "2"}
     metadata2 = {"a": "3", "d": "4"}
     should_be = metadata2
     share_id = str(uuid.uuid4())
     db_driver.share_create(self.context, {"id": share_id, "metadata": metadata1})
     db_driver.share_metadata_update(self.context, share_id, metadata2, True)
     self.assertEqual(should_be, db_driver.share_metadata_get(self.context, share_id))
Example #3
0
 def setUp(self):
     super(ShareMetaDataTest, self).setUp()
     self.share_api = api.API()
     self.share_controller = shares.ShareController()
     self.controller = share_metadata.ShareMetadataController()
     self.ctxt = context.RequestContext("admin", "fake", True)
     self.origin_metadata = {"key1": "value1", "key2": "value2", "key3": "value3"}
     self.share = db.share_create(self.ctxt, {})
     self.share_id = self.share["id"]
     self.url = "/shares/%s/metadata" % self.share_id
     db.share_metadata_update(self.ctxt, self.share_id, self.origin_metadata, delete=False)
Example #4
0
 def test_share_metadata_update_delete(self):
     metadata1 = {'a': '1', 'c': '2'}
     metadata2 = {'a': '3', 'd': '4'}
     should_be = metadata2
     share_id = str(uuid.uuid4())
     db_driver.share_create(self.context,
                            {'id': share_id, 'metadata': metadata1})
     db_driver.share_metadata_update(self.context, share_id,
                                     metadata2, True)
     self.assertEqual(should_be,
                      db_driver.share_metadata_get(self.context, share_id))
Example #5
0
 def test_share_metadata_update_delete(self):
     metadata1 = {'a': '1', 'c': '2'}
     metadata2 = {'a': '3', 'd': '4'}
     should_be = metadata2
     share_id = str(uuid.uuid4())
     db_driver.share_create(self.context,
                            {'id': share_id, 'metadata': metadata1})
     db_driver.share_metadata_update(self.context, share_id,
                                     metadata2, True)
     self.assertEqual(should_be,
                      db_driver.share_metadata_get(self.context, share_id))
Example #6
0
 def setUp(self):
     super(ShareMetaDataTest, self).setUp()
     self.share_api = api.API()
     self.share_controller = shares.ShareController()
     self.controller = share_metadata.ShareMetadataController()
     self.ctxt = context.RequestContext('admin', 'fake', True)
     self.origin_metadata = {
         "key1": "value1",
         "key2": "value2",
         "key3": "value3",
     }
     self.share = db.share_create(self.ctxt, {})
     self.share_id = self.share['id']
     self.url = '/shares/%s/metadata' % self.share_id
     db.share_metadata_update(
         self.ctxt, self.share_id, self.origin_metadata, delete=False)
Example #7
0
 def test_index_no_data(self):
     db.share_metadata_update(self.ctxt, self.share_id, {}, delete=True)
     req = fakes.HTTPRequest.blank(self.url)
     res_dict = self.controller.index(req, self.share_id)
     expected = {"metadata": {}}
     self.assertEqual(expected, res_dict)