Esempio n. 1
0
    def test_swift_object_exists(self):
        container = self.containers.first()
        obj = self.objects.first()

        swift_api = self.stub_swiftclient(expected_calls=2)
        swift_api.head_object(container.name, obj.name).AndReturn(container)

        exc = self.exceptions.swift
        swift_api.head_object(container.name, obj.name).AndRaise(exc)
        self.mox.ReplayAll()

        args = self.request, container.name, obj.name
        self.assertTrue(api.swift_object_exists(*args))
        # Again, for a "non-existent" object
        self.assertFalse(api.swift_object_exists(*args))
Esempio n. 2
0
    def test_swift_object_exists(self):
        container = self.containers.first()
        obj = self.objects.first()

        swift_api = self.stub_swiftclient(expected_calls=2)
        self.mox.StubOutWithMock(container, 'get_object')
        swift_api.get_container(container.name).AndReturn(container)
        container.get_object(obj.name).AndReturn(obj)
        swift_api.get_container(container.name).AndReturn(container)
        exc = cloudfiles.errors.NoSuchObject()
        container.get_object(obj.name).AndRaise(exc)
        self.mox.ReplayAll()

        args = self.request, container.name, obj.name
        self.assertTrue(api.swift_object_exists(*args))
        # Again, for a "non-existent" object
        self.assertFalse(api.swift_object_exists(*args))
Esempio n. 3
0
    def test_swift_object_exists(self):
        container = self.containers.first()
        obj = self.objects.first()

        swift_api = self.stub_swiftclient(expected_calls=2)
        self.mox.StubOutWithMock(container, 'get_object')
        swift_api.get_container(container.name).AndReturn(container)
        container.get_object(obj.name).AndReturn(obj)
        swift_api.get_container(container.name).AndReturn(container)
        exc = cloudfiles.errors.NoSuchObject()
        container.get_object(obj.name).AndRaise(exc)
        self.mox.ReplayAll()

        args = self.request, container.name, obj.name
        self.assertTrue(api.swift_object_exists(*args))
        # Again, for a "non-existent" object
        self.assertFalse(api.swift_object_exists(*args))