コード例 #1
0
ファイル: walrus_object.py プロジェクト: aliceh/eutester
 def setUpClass(cls):
     print_header("Setting up Bucket Test")
     random.seed(time.time())
     host = config.endpoint
     path = config.path
     port = config.port
     access_key = config.access_key
     secret_key = config.secret_key
     
     print "Config = (" + host + ":" + str(port) + path + "--" + access_key + "--" + secret_key + ")"                
     cls.walrus = S3Connection(host=host,path=path,port=port,aws_access_key_id=access_key,aws_secret_access_key=secret_key,is_secure=False,calling_format=OrdinaryCallingFormat(), debug=2)
     
     #Create some test data for the objects
     cls.test_object_data = ""
     for i in range(0, cls.data_size):
         cls.test_object_data += chr(random.randint(32,126))
         
     print "Generated data for objects: " + cls.test_object_data
     
     #TODO: delete all versions and delete markers so that a versioned bucket can be deleted
     #Clean up existing buckets etc to make sure the test is clear.
     print "Cleaning existing buckets with " + ObjectTest.bucket_prefix + " prefix from previous tests"
     try :
         listing = ObjectTest.walrus.get_all_buckets()        
         for bucket in listing:
             if bucket.name.startswith(ObjectTest.bucket_prefix):
                 clean_bucket(bucket)
             else:
                 print "skipping bucket: " + bucket.name
     except S3ResponseError as e:
         print "Exception caught doing bucket cleanup."
                     
     print "Done with test setup\n\n"
コード例 #2
0
ファイル: walrus_object.py プロジェクト: aliceh/eutester
 def tearDown(self):
     """Tearing down the env after a test"""
     print_header("Cleaning up the test bucket: " + self.test_bucket_name)
     clean_bucket(self.test_bucket)
     self.test_bucket = None