Exemple #1
0
    def test_no_bucket_in_instances_(self):
        s3_backend = s3_models.S3Backend()

        bucket_name = 'test'
        region = 'us-east-1'

        s3_backend.create_bucket(bucket_name, region)

        s3_backend.delete_bucket(bucket_name)
        bucket = s3_backend.create_bucket(bucket_name, region)

        self.assertGreaterEqual(bucket in (bucket.instances or []), False)
Exemple #2
0
    def test_no_bucket_in_instances(self):
        s3_backend = s3_models.S3Backend()

        bucket_name = "test"
        region = "us-east-1"

        s3_backend.create_bucket(bucket_name, region)

        s3_backend.delete_bucket(bucket_name)
        bucket = s3_backend.create_bucket(bucket_name, region)

        self.assertNotIn(bucket, (bucket.instances or []))
Exemple #3
0
    def test_key_instances_before_removing(self):
        s3_backend = s3_models.S3Backend()

        bucket_name = 'test'
        region = 'us-east-1'

        file1_name = 'file.txt'
        file2_name = 'file2.txt'
        file_value = b'content'

        s3_backend.create_bucket(bucket_name, region)
        s3_backend.set_object(bucket_name, file1_name, file_value)
        s3_backend.set_object(bucket_name, file2_name, file_value)

        key = s3_backend.get_object(bucket_name, file2_name)

        self.assertEqual(key in (key.instances or []), False)
Exemple #4
0
    def test_key_instances_before_removing(self):
        s3_backend = s3_models.S3Backend()

        bucket_name = "test"
        region = "us-east-1"

        file1_name = "file.txt"
        file2_name = "file2.txt"
        file_value = b"content"

        s3_backend.create_bucket(bucket_name, region)
        s3_backend.put_object(bucket_name, file1_name, file_value)
        s3_backend.put_object(bucket_name, file2_name, file_value)

        key = s3_backend.get_object(bucket_name, file2_name)

        self.assertNotIn(key, key.instances or [])