Exemple #1
0
    def test_functional_create_container_and_object_then_delete_all(self):
        names_list = ["111", "222", "333", "444", "555"]

        scenario = objects.CreateContainerAndObjectThenDeleteAll(self.context)
        scenario.generate_random_name = mock.MagicMock(side_effect=names_list)
        scenario._delete_object = mock.MagicMock()
        scenario._delete_container = mock.MagicMock()

        scenario.run(objects_per_container=4, object_size=240)

        scenario._delete_object.assert_has_calls(
            [mock.call("111", name) for name in names_list[1:]])
        scenario._delete_container.assert_called_once_with("111")
Exemple #2
0
    def test_create_container_and_object_then_delete_all(self):
        scenario = objects.CreateContainerAndObjectThenDeleteAll(self.context)
        scenario._create_container = mock.MagicMock(return_value="BB")
        scenario._upload_object = mock.MagicMock(
            side_effect=[("etaaag", "ooobj_%i" % i) for i in range(3)])
        scenario._delete_object = mock.MagicMock()
        scenario._delete_container = mock.MagicMock()

        scenario.run(objects_per_container=3, object_size=10)

        self.assertEqual(1, scenario._create_container.call_count)
        self.assertEqual(3, scenario._upload_object.call_count)
        scenario._delete_object.assert_has_calls(
            [mock.call("BB", "ooobj_%i" % i) for i in range(3)])
        scenario._delete_container.assert_called_once_with("BB")