Exemple #1
0
    def test_create_objects(self):

        self.useFixture(mockpatch.PatchObject(javelin, "client_for_user", return_value=self.fake_client))
        self.useFixture(mockpatch.PatchObject(javelin, "_assign_swift_role"))
        self.useFixture(mockpatch.PatchObject(javelin, "_file_contents", return_value=self.fake_object.content))

        javelin.create_objects([self.fake_object])

        mocked_function = self.fake_client.containers.create_container
        mocked_function.assert_called_once_with(self.fake_object["container"])
        mocked_function = self.fake_client.objects.create_object
        mocked_function.assert_called_once_with(
            self.fake_object["container"], self.fake_object["name"], self.fake_object.content
        )
Exemple #2
0
    def test_create_objects(self):

        self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
                                              return_value=self.fake_client))
        self.useFixture(mockpatch.PatchObject(javelin, "_assign_swift_role"))
        self.useFixture(mockpatch.PatchObject(javelin, "_file_contents",
                        return_value=self.fake_object.content))

        javelin.create_objects([self.fake_object])

        mocked_function = self.fake_client.containers.create_container
        mocked_function.assert_called_once_with(self.fake_object['container'])
        mocked_function = self.fake_client.objects.create_object
        mocked_function.assert_called_once_with(self.fake_object['container'],
                                                self.fake_object['name'],
                                                self.fake_object.content)