Beispiel #1
0
    def test_stage(self):
        sot = image.Image(**EXAMPLE)

        self.assertIsNotNone(sot.stage(self.sess))
        self.sess.put.assert_called_with('images/IDENTIFIER/stage',
                                         data=sot.data,
                                         headers={
                                             "Content-Type":
                                             "application/octet-stream",
                                             "Accept": ""
                                         })
Beispiel #2
0
    def test_download_checksum_mismatch(self):
        sot = image.Image(**EXAMPLE)

        resp = FakeResponse(b"abc",
                            headers={
                                "Content-MD5": "the wrong checksum",
                                "Content-Type": "application/octet-stream"
                            })
        self.sess.get.return_value = resp

        self.assertRaises(exceptions.InvalidResponse, sot.download, self.sess)
 def test_basic(self):
     sot = image.Image()
     self.assertIsNone(sot.resource_key)
     self.assertEqual('images', sot.resources_key)
     self.assertEqual('/images', sot.base_path)
     self.assertEqual('image', sot.service.service_type)
     self.assertTrue(sot.allow_create)
     self.assertTrue(sot.allow_get)
     self.assertTrue(sot.allow_update)
     self.assertTrue(sot.allow_delete)
     self.assertTrue(sot.allow_list)
    def test_upload(self):
        sot = image.Image(**EXAMPLE)

        self.assertIsNone(sot.upload(self.sess))
        self.sess.put.assert_called_with('images/IDENTIFIER/file',
                                         endpoint_filter=sot.service,
                                         data=sot.data,
                                         headers={
                                             "Content-Type":
                                             "application/octet-stream",
                                             "Accept": ""
                                         })
Beispiel #5
0
    def test_upload_checksum_match(self):
        sot = image.Image(**EXAMPLE)

        resp = mock.Mock()
        resp.content = b"abc"
        resp.headers = {"Content-MD5": "900150983cd24fb0d6963f7d28e17f72"}
        self.sess.get.return_value = resp

        rv = sot.download(self.sess)
        self.sess.get.assert_called_with('images/IDENTIFIER/file',
                                         endpoint_filter=sot.service)

        self.assertEqual(rv, resp.content)
Beispiel #6
0
 def test_image_import(self):
     original_image = image.Image(**EXAMPLE)
     self._verify("openstack.image.v2.image.Image.import_image",
                  self.proxy.import_image,
                  method_args=[original_image, "method", "uri"],
                  expected_kwargs={
                      "method": "method",
                      "store": None,
                      "uri": "uri",
                      "stores": [],
                      "all_stores": None,
                      "all_stores_must_succeed": None,
                  })
Beispiel #7
0
    def test_download_stream(self):
        sot = image.Image(**EXAMPLE)

        resp = FakeResponse(
            b"abc",
            headers={"Content-MD5": "900150983cd24fb0d6963f7d28e17f72",
                     "Content-Type": "application/octet-stream"})
        self.sess.get.return_value = resp

        rv = sot.download(self.sess, stream=True)
        self.sess.get.assert_called_with('images/IDENTIFIER/file', stream=True)

        self.assertEqual(rv, resp)
Beispiel #8
0
 def test_image_download(self):
     original_image = image.Image(**EXAMPLE)
     self._verify('openstack.image.v2.image.Image.download',
                  self.proxy.download_image,
                  method_args=[original_image],
                  method_kwargs={
                      'output': 'some_output',
                      'chunk_size': 1,
                      'stream': True
                  },
                  expected_kwargs={'output': 'some_output',
                                   'chunk_size': 1,
                                   'stream': True})
Beispiel #9
0
 def test_image_download_output_fd(self):
     output_file = io.BytesIO()
     sot = image.Image(**EXAMPLE)
     response = mock.Mock()
     response.status_code = 200
     response.iter_content.return_value = [b'01', b'02']
     response.headers = {
         'Content-MD5':
         calculate_md5_checksum(response.iter_content.return_value)
     }
     self.sess.get = mock.Mock(return_value=response)
     sot.download(self.sess, output=output_file)
     output_file.seek(0)
     self.assertEqual(b'0102', output_file.read())
Beispiel #10
0
    def test_image_create_checksum_mismatch(self):
        fake_image = image.Image(
            id="fake", properties={
                self.proxy._IMAGE_MD5_KEY: 'fake_md5',
                self.proxy._IMAGE_SHA256_KEY: 'fake_sha256'
            })
        self.proxy.find_image = mock.Mock(return_value=fake_image)

        self.proxy._upload_image = mock.Mock()

        self.proxy.create_image(
            name='fake', data=b'fake',
            md5='fake2_md5', sha256='fake2_sha256'
        )
        self.proxy._upload_image.assert_called()
 def test_create(self):
     sot = volume.Volume(VOLUME)
     self.assertEqual(VOLUME["id"], sot.id)
     self.assertEqual(VOLUME["status"], sot.status)
     self.assertEqual(VOLUME["attachments"], sot.attachments)
     self.assertEqual(VOLUME["availability_zone"], sot.availability_zone)
     self.assertEqual(VOLUME["bootable"], sot.bootable)
     self.assertEqual(VOLUME["created_at"], sot.created)
     self.assertEqual(VOLUME["description"], sot.description)
     self.assertEqual(type.Type({"id": VOLUME["volume_type"]}), sot.type)
     self.assertEqual(VOLUME["snapshot_id"], sot.snapshot)
     self.assertEqual(VOLUME["source_volid"], sot.source_volume)
     self.assertEqual(VOLUME["metadata"], sot.metadata)
     self.assertEqual(VOLUME["size"], sot.size)
     self.assertEqual(image.Image({"id": VOLUME["image"]}), sot.image)
Beispiel #12
0
 def test_import_image_with_store(self):
     sot = image.Image(**EXAMPLE)
     json = {
         "method": {
             "name": "web-download",
             "uri": "such-a-good-uri",
         },
         "stores": ["ceph_1"],
     }
     store = mock.MagicMock()
     store.id = "ceph_1"
     sot.import_image(self.sess, "web-download", "such-a-good-uri", store)
     self.sess.post.assert_called_with(
         'images/IDENTIFIER/import',
         headers={'X-Image-Meta-Store': 'ceph_1'},
         json=json)
    def test_basic(self):
        sot = image.Image()
        self.assertIsNone(sot.resource_key)
        self.assertEqual('images', sot.resources_key)
        self.assertEqual('/images', sot.base_path)
        self.assertEqual('image', sot.service.service_type)
        self.assertTrue(sot.allow_create)
        self.assertTrue(sot.allow_get)
        self.assertTrue(sot.allow_update)
        self.assertTrue(sot.allow_delete)
        self.assertTrue(sot.allow_list)

        self.assertDictEqual(
            {
                "name": "name",
                "visibility": "visibility",
                "member_status": "member_status",
                "owner": "owner",
                "status": "status",
                "size_min": "size_min",
                "size_max": "size_max",
                "sort_key": "sort_key",
                "sort_dir": "sort_dir",
                "sort": "sort",
                "tag": "tag",
                "created_at": "created_at",
                "updated_at": "updated_at",
                "__platform": "__platform",
                "__imagetype": "__imagetype",
                "__os_version": "__os_version",
                "__isregistered": "__isregistered",
                "protected": "protected",
                "id": "id",
                "container_format": "container_format",
                "disk_format": "disk_format",
                "min_ram": "min_ram",
                "min_disk": "min_disk",
                "__os_bit": "__os_bit",
                "__os_type": "__os_type",
                "__support_kvm": "__support_kvm",
                "__support_xen": "__support_xen",
                "__support_diskintensive": "__support_diskintensive",
                "__support_highperformance": "__support_highperformance",
                "__support_xen_gpu_type": "__support_xen_gpu_type",
                "limit": "limit",
                "marker": "marker"
            }, sot._query_mapping._mapping)
 def test_make_it(self):
     sot = image.Image(EXAMPLE)
     self.assertEqual(IDENTIFIER, sot.id)
     self.assertEqual(EXAMPLE['checksum'], sot.checksum)
     self.assertEqual(EXAMPLE['container_format'], sot.container_format)
     self.assertEqual(EXAMPLE['created_at'], sot.created_at)
     self.assertEqual(EXAMPLE['disk_format'], sot.disk_format)
     self.assertEqual(EXAMPLE['min_disk'], sot.min_disk)
     self.assertEqual(EXAMPLE['name'], sot.name)
     self.assertEqual(EXAMPLE['owner'], sot.owner)
     self.assertEqual(EXAMPLE['properties'], sot.properties)
     self.assertEqual(EXAMPLE['protected'], sot.protected)
     self.assertEqual(EXAMPLE['status'], sot.status)
     self.assertEqual(EXAMPLE['tags'], sot.tags)
     self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
     self.assertEqual(EXAMPLE['virtual_size'], sot.virtual_size)
     self.assertEqual(EXAMPLE['visibility'], sot.visibility)
Beispiel #15
0
    def test_download_no_checksum_header(self):
        sot = image.Image(**EXAMPLE)

        resp1 = FakeResponse(
            b"abc", headers={"Content-Type": "application/octet-stream"})

        resp2 = FakeResponse({"checksum": "900150983cd24fb0d6963f7d28e17f72"})

        self.sess.get.side_effect = [resp1, resp2]

        rv = sot.download(self.sess)
        self.sess.get.assert_has_calls([
            mock.call('images/IDENTIFIER/file', stream=False),
            mock.call('images/IDENTIFIER', microversion=None, params={})
        ])

        self.assertEqual(rv, resp1)
    def test_import(self):
        self.resp = mock.Mock()
        self.resp.status_code = 204
        self.sess = mock.Mock()
        self.sess.put = mock.Mock()
        self.sess.put.return_value = self.resp

        sot = image.Image(EXAMPLE)
        sot.upload_image(self.sess)

        headers = {'Content-Type': 'application/octet-stream'}

        self.sess.put.assert_called_with('images/IDENTIFIER/file',
                                         service=sot.service,
                                         data=EXAMPLE['data'],
                                         accept=None,
                                         headers=headers)
Beispiel #17
0
    def test_image_upload(self):
        # NOTE: This doesn't use any of the base class verify methods
        # because it ends up making two separate calls to complete the
        # operation.
        created_image = mock.Mock(spec=image.Image(id="id"))

        self.proxy._create = mock.Mock()
        self.proxy._create.return_value = created_image

        rv = self.proxy.upload_image(data="data", container_format="x",
                                     disk_format="y", name="z")

        self.proxy._create.assert_called_with(image.Image,
                                              container_format="x",
                                              disk_format="y",
                                              name="z")
        created_image.upload.assert_called_with(self.proxy)
        self.assertEqual(rv, created_image)
Beispiel #18
0
 def test_import_image_with_all_stores(self):
     sot = image.Image(**EXAMPLE)
     json = {
         "method": {
             "name": "web-download",
             "uri": "such-a-good-uri",
         },
         "all_stores": True,
     }
     sot.import_image(
         self.sess,
         "web-download",
         "such-a-good-uri",
         all_stores=True,
     )
     self.sess.post.assert_called_with(
         'images/IDENTIFIER/import',
         headers={},
         json=json,
     )
 def test_make_it(self):
     sot = image.Image(EXAMPLE)
     self.assertEqual(IDENTIFIER, sot.id)
     self.assertEqual(EXAMPLE['checksum'], sot.checksum)
     self.assertEqual(EXAMPLE['container_format'], sot.container_format)
     dt = datetime.datetime(2015, 3, 9, 12, 14, 57,
                            233772).replace(tzinfo=None)
     self.assertEqual(dt, sot.created_at.replace(tzinfo=None))
     self.assertEqual(EXAMPLE['disk_format'], sot.disk_format)
     self.assertEqual(EXAMPLE['min_disk'], sot.min_disk)
     self.assertEqual(EXAMPLE['name'], sot.name)
     self.assertEqual(EXAMPLE['owner'], sot.owner_id)
     self.assertEqual(EXAMPLE['properties'], sot.properties)
     self.assertFalse(sot.is_protected)
     self.assertEqual(EXAMPLE['status'], sot.status)
     self.assertEqual(EXAMPLE['tags'], sot.tags)
     dt = datetime.datetime(2015, 3, 9, 12, 15, 57,
                            233772).replace(tzinfo=None)
     self.assertEqual(dt, sot.updated_at.replace(tzinfo=None))
     self.assertEqual(EXAMPLE['virtual_size'], sot.virtual_size)
     self.assertEqual(EXAMPLE['visibility'], sot.visibility)
Beispiel #20
0
    def test_download_no_checksum_header(self):
        sot = image.Image(**EXAMPLE)

        resp1 = mock.Mock()
        resp1.content = b"abc"
        resp1.headers = {"no_checksum_here": ""}

        resp2 = mock.Mock()
        resp2.json = mock.Mock(
            return_value={"checksum": "900150983cd24fb0d6963f7d28e17f72"})
        resp2.headers = {"": ""}

        self.sess.get.side_effect = [resp1, resp2]

        rv = sot.download(self.sess)
        self.sess.get.assert_has_calls(
            [mock.call('images/IDENTIFIER/file', endpoint_filter=sot.service,
                       stream=False),
             mock.call('images/IDENTIFIER', endpoint_filter=sot.service)])

        self.assertEqual(rv, resp1.content)
Beispiel #21
0
def create_one_image(attrs=None):
    """Create a fake image.

    :param attrs: A dictionary with all attributes of image
    :type attrs: dict
    :return: A fake Image object.
    :rtype: `openstack.image.v2.image.Image`
    """
    attrs = attrs or {}

    # Set default attribute
    image_info = {
        'id': str(uuid.uuid4()),
        'name': 'image-name' + uuid.uuid4().hex,
        'owner_id': 'image-owner' + uuid.uuid4().hex,
        'is_protected': bool(random.choice([0, 1])),
        'visibility': random.choice(['public', 'private']),
        'tags': [uuid.uuid4().hex for r in range(2)],
    }

    # Overwrite default attributes if there are some attributes set
    image_info.update(attrs)

    return image.Image(**image_info)
Beispiel #22
0
 def test_reactivate(self):
     sot = image.Image(**EXAMPLE)
     self.assertIsNone(sot.reactivate(self.sess))
     self.sess.post.assert_called_with(
         'images/IDENTIFIER/actions/reactivate',
     )
Beispiel #23
0
 def test_import_image(self):
     sot = image.Image(**EXAMPLE)
     json = {"method": {"name": "web-download", "uri": "such-a-good-uri"}}
     sot.import_image(self.sess, "web-download", "such-a-good-uri")
     self.sess.post.assert_called_with('images/IDENTIFIER/import',
                                       json=json)
Beispiel #24
0
    def test_image_stage_wrong_status(self):
        img = image.Image(id="id", status="active")
        img.stage = mock.Mock()

        self.assertRaises(exceptions.SDKException, self.proxy.stage_image, img,
                          "data")
Beispiel #25
0
 def test_make_it(self):
     sot = image.Image(**EXAMPLE)
     self.assertEqual(IDENTIFIER, sot.id)
     self.assertEqual(EXAMPLE['checksum'], sot.checksum)
     self.assertEqual(EXAMPLE['container_format'], sot.container_format)
     self.assertEqual(EXAMPLE['created_at'], sot.created_at)
     self.assertEqual(EXAMPLE['disk_format'], sot.disk_format)
     self.assertEqual(EXAMPLE['min_disk'], sot.min_disk)
     self.assertEqual(EXAMPLE['name'], sot.name)
     self.assertEqual(EXAMPLE['owner'], sot.owner_id)
     self.assertEqual(EXAMPLE['properties'], sot.properties)
     self.assertFalse(sot.is_protected)
     self.assertEqual(EXAMPLE['status'], sot.status)
     self.assertEqual(EXAMPLE['tags'], sot.tags)
     self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
     self.assertEqual(EXAMPLE['virtual_size'], sot.virtual_size)
     self.assertEqual(EXAMPLE['visibility'], sot.visibility)
     self.assertEqual(EXAMPLE['size'], sot.size)
     self.assertEqual(EXAMPLE['store'], sot.store)
     self.assertEqual(EXAMPLE['file'], sot.file)
     self.assertEqual(EXAMPLE['locations'], sot.locations)
     self.assertEqual(EXAMPLE['direct_url'], sot.direct_url)
     self.assertEqual(EXAMPLE['url'], sot.url)
     self.assertEqual(EXAMPLE['metadata'], sot.metadata)
     self.assertEqual(EXAMPLE['architecture'], sot.architecture)
     self.assertEqual(EXAMPLE['hypervisor-type'], sot.hypervisor_type)
     self.assertEqual(EXAMPLE['instance_type_rxtx_factor'],
                      sot.instance_type_rxtx_factor)
     self.assertEqual(EXAMPLE['instance_uuid'], sot.instance_uuid)
     self.assertEqual(EXAMPLE['img_config_drive'], sot.needs_config_drive)
     self.assertEqual(EXAMPLE['kernel_id'], sot.kernel_id)
     self.assertEqual(EXAMPLE['os_distro'], sot.os_distro)
     self.assertEqual(EXAMPLE['os_version'], sot.os_version)
     self.assertEqual(EXAMPLE['os_secure_boot'], sot.needs_secure_boot)
     self.assertEqual(EXAMPLE['ramdisk_id'], sot.ramdisk_id)
     self.assertEqual(EXAMPLE['vm_mode'], sot.vm_mode)
     self.assertEqual(EXAMPLE['hw_cpu_sockets'], sot.hw_cpu_sockets)
     self.assertEqual(EXAMPLE['hw_cpu_cores'], sot.hw_cpu_cores)
     self.assertEqual(EXAMPLE['hw_cpu_threads'], sot.hw_cpu_threads)
     self.assertEqual(EXAMPLE['hw_disk_bus'], sot.hw_disk_bus)
     self.assertEqual(EXAMPLE['hw_rng_model'], sot.hw_rng_model)
     self.assertEqual(EXAMPLE['hw_machine_type'], sot.hw_machine_type)
     self.assertEqual(EXAMPLE['hw_scsi_model'], sot.hw_scsi_model)
     self.assertEqual(EXAMPLE['hw_serial_port_count'],
                      sot.hw_serial_port_count)
     self.assertEqual(EXAMPLE['hw_video_model'], sot.hw_video_model)
     self.assertEqual(EXAMPLE['hw_video_ram'], sot.hw_video_ram)
     self.assertEqual(EXAMPLE['hw_watchdog_action'], sot.hw_watchdog_action)
     self.assertEqual(EXAMPLE['os_command_line'], sot.os_command_line)
     self.assertEqual(EXAMPLE['hw_vif_model'], sot.hw_vif_model)
     self.assertEqual(EXAMPLE['hw_vif_multiqueue_enabled'],
                      sot.is_hw_vif_multiqueue_enabled)
     self.assertEqual(EXAMPLE['hw_boot_menu'], sot.is_hw_boot_menu_enabled)
     self.assertEqual(EXAMPLE['vmware_adaptertype'], sot.vmware_adaptertype)
     self.assertEqual(EXAMPLE['vmware_ostype'], sot.vmware_ostype)
     self.assertEqual(EXAMPLE['auto_disk_config'], sot.has_auto_disk_config)
     self.assertEqual(EXAMPLE['os_type'], sot.os_type)
     self.assertEqual(EXAMPLE['os_admin_user'], sot.os_admin_user)
     self.assertEqual(EXAMPLE['hw_qemu_guest_agent'],
                      sot.hw_qemu_guest_agent)
     self.assertEqual(EXAMPLE['os_require_quiesce'], sot.os_require_quiesce)
Beispiel #26
0
 def test_image_import_no_required_attrs(self):
     # container_format and disk_format are required attrs of the image
     existing_image = image.Image(id="id")
     self.assertRaises(exceptions.InvalidRequest, self.proxy.import_image,
                       existing_image)
Beispiel #27
0
    def test_stage_error(self):
        sot = image.Image(**EXAMPLE)

        self.sess.put.return_value = FakeResponse("dummy", status_code=400)
        self.assertRaises(exceptions.SDKException, sot.stage, self.sess)
Beispiel #28
0
 def test_import_image_with_uri_not_web_download(self):
     sot = image.Image(**EXAMPLE)
     self.assertRaises(exceptions.InvalidRequest, sot.import_image,
                       self.sess, "glance-direct", "such-a-good-uri")
Beispiel #29
0
 def test_make_it(self):
     sot = server.Server(**EXAMPLE)
     self.assertEqual(EXAMPLE['accessIPv4'], sot.access_ipv4)
     self.assertEqual(EXAMPLE['accessIPv6'], sot.access_ipv6)
     self.assertEqual(EXAMPLE['addresses'], sot.addresses)
     self.assertEqual(EXAMPLE['created'], sot.created_at)
     self.assertEqual(EXAMPLE['config_drive'], sot.has_config_drive)
     self.assertEqual(EXAMPLE['flavorRef'], sot.flavor_id)
     self.assertEqual(EXAMPLE['flavor'], sot.flavor)
     self.assertEqual(EXAMPLE['hostId'], sot.host_id)
     self.assertEqual(EXAMPLE['host_status'], sot.host_status)
     self.assertEqual(EXAMPLE['id'], sot.id)
     self.assertEqual(EXAMPLE['imageRef'], sot.image_id)
     self.assertEqual(image.Image(**EXAMPLE['image']), sot.image)
     self.assertEqual(EXAMPLE['links'], sot.links)
     self.assertEqual(EXAMPLE['metadata'], sot.metadata)
     self.assertEqual(EXAMPLE['networks'], sot.networks)
     self.assertEqual(EXAMPLE['name'], sot.name)
     self.assertEqual(EXAMPLE['progress'], sot.progress)
     self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
     self.assertEqual(EXAMPLE['status'], sot.status)
     self.assertEqual(EXAMPLE['updated'], sot.updated_at)
     self.assertEqual(EXAMPLE['user_id'], sot.user_id)
     self.assertEqual(EXAMPLE['key_name'], sot.key_name)
     self.assertEqual(EXAMPLE['OS-DCF:diskConfig'], sot.disk_config)
     self.assertEqual(EXAMPLE['OS-EXT-AZ:availability_zone'],
                      sot.availability_zone)
     self.assertEqual(EXAMPLE['OS-EXT-STS:power_state'], sot.power_state)
     self.assertEqual(EXAMPLE['OS-EXT-STS:task_state'], sot.task_state)
     self.assertEqual(EXAMPLE['OS-EXT-STS:vm_state'], sot.vm_state)
     self.assertEqual(EXAMPLE['os-extended-volumes:volumes_attached'],
                      sot.attached_volumes)
     self.assertEqual(EXAMPLE['OS-SRV-USG:launched_at'], sot.launched_at)
     self.assertEqual(EXAMPLE['OS-SRV-USG:terminated_at'],
                      sot.terminated_at)
     self.assertEqual(EXAMPLE['security_groups'], sot.security_groups)
     self.assertEqual(EXAMPLE['adminPass'], sot.admin_password)
     self.assertEqual(EXAMPLE['personality'], sot.personality)
     self.assertEqual(EXAMPLE['block_device_mapping_v2'],
                      sot.block_device_mapping)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:host'],
                      sot.compute_host)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:hostname'],
                      sot.hostname)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:hypervisor_hostname'],
                      sot.hypervisor_hostname)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:instance_name'],
                      sot.instance_name)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:kernel_id'],
                      sot.kernel_id)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:launch_index'],
                      sot.launch_index)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:ramdisk_id'],
                      sot.ramdisk_id)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:reservation_id'],
                      sot.reservation_id)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:root_device_name'],
                      sot.root_device_name)
     self.assertEqual(EXAMPLE['OS-SCH-HNT:scheduler_hints'],
                      sot.scheduler_hints)
     self.assertEqual(EXAMPLE['OS-EXT-SRV-ATTR:user_data'], sot.user_data)
     self.assertEqual(EXAMPLE['locked'], sot.is_locked)
     self.assertEqual(EXAMPLE['trusted_image_certificates'],
                      sot.trusted_image_certificates)
Beispiel #30
0
    def test_add_tag(self):
        sot = image.Image(**EXAMPLE)
        tag = "lol"

        sot.add_tag(self.sess, tag)
        self.sess.put.assert_called_with('images/IDENTIFIER/tags/%s' % tag, )