From fd5f29b7f8ff5537531cad4f5f025ef847653d86 Mon Sep 17 00:00:00 2001 From: lewzylu <327874225@qq.com> Date: Mon, 24 Jul 2017 17:45:41 +0800 Subject: [PATCH] Remove testfile --- test/test_bucket.py | 61 ----------------------------------- test/test_object.py | 77 --------------------------------------------- 2 files changed, 138 deletions(-) delete mode 100644 test/test_bucket.py delete mode 100644 test/test_object.py diff --git a/test/test_bucket.py b/test/test_bucket.py deleted file mode 100644 index 829670d2..00000000 --- a/test/test_bucket.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding=utf-8 -import cos_client -import logging -import random -import sys - -reload(sys) -sys.setdefaultencoding('utf-8') -logger = logging.getLogger(__name__) -logging.basicConfig(level=logging.INFO, stream=sys.stdout, format="%(asctime)s - %(message)s") -access_id = "AKID15IsskiBQKTZbAo6WhgcBqVls9SmuG00" -access_key = "ciivKvnnrMvSvQpMAWuIz12pThGGlWRW" -test_num = 10 - - -def setUp(): - print "Test bucket interface" - - -def tearDown(): - print "test over" - - -def Test_bucket(): - for i in range(test_num): - bucket_id = str(random.randint(0, 1000)) + str(random.randint(0, 1000)) - conf = cos_client.CosConfig( - appid="1252448703", - bucket="test" + str(bucket_id), - region="cn-north", - access_id=access_id, - access_key=access_key, - part_size=1, - max_thread=5) - client = cos_client.CosS3Client(conf) - buc_int = client.buc_int() - print "Test create bucket " + conf._bucket - sys.stdout.flush() - rt = buc_int.create_bucket() - assert rt - print "Test get bucket " + conf._bucket - sys.stdout.flush() - rt = buc_int.get_bucket() - assert rt - print "Test put bucket acl " + conf._bucket - sys.stdout.flush() - rt = buc_int.put_bucket_acl("anyone,1231,3210232098/345725437", None, "anyone") - assert rt - print "Test get bucket acl " + conf._bucket - sys.stdout.flush() - rt = buc_int.get_bucket_acl() - assert rt - print "Test delete bucket " + conf._bucket - sys.stdout.flush() - rt = buc_int.delete_bucket() - assert rt - - -if __name__ == "__main__": - setUp() - Test_bucket() diff --git a/test/test_object.py b/test/test_object.py deleted file mode 100644 index e0b88895..00000000 --- a/test/test_object.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding=utf-8 -import cos_client -import logging -import random -import sys -import os - -reload(sys) -sys.setdefaultencoding('utf-8') -logger = logging.getLogger(__name__) -logging.basicConfig(level=logging.INFO, stream=sys.stdout, format="%(asctime)s - %(message)s") -access_id = "AKID15IsskiBQKTZbAo6WhgcBqVls9SmuG00" -access_key = "ciivKvnnrMvSvQpMAWuIz12pThGGlWRW" -file_id = str(random.randint(0, 1000)) + str(random.randint(0, 1000)) -test_num = 10 - - -def gen_file(path, size): - file = open(path, 'w') - file.seek(1024*1024*size) - file.write('\x00') - file.close() - - -def setUp(): - print "object interface test" - print "config" - conf = cos_client.CosConfig( - appid="1252448703", - bucket="lewzylu06", - region="cn-north", - access_id=access_id, - access_key=access_key, - part_size=1, - max_thread=5 - ) - client = cos_client.CosS3Client(conf) - global obj_int - obj_int = client.obj_int() - - -def tearDown(): - print "test over" - - -def Test_object(): - for i in range(test_num): - file_size = 3.1 * i + 0.1 - file_name = "tmp" + file_id + "_" + str(file_size) + "MB" - print "Test upload " + file_name - sys.stdout.flush() - gen_file(file_name, file_size) - global obj_int - rt = obj_int.upload_file(file_name, file_name) - assert rt - print "Test put object acl " + file_name - sys.stdout.flush() - rt = obj_int.put_object_acl("anyone,1231,3210232098/345725437", None, "anyone", file_name) - assert rt - print "Test get object acl " + file_name - sys.stdout.flush() - rt = obj_int.get_object_acl(file_name) - assert rt - print "Test download " + file_name - sys.stdout.flush() - rt = obj_int.download_file(file_name, file_name) - assert rt - os.remove(file_name) - print "Test delete " + file_name - sys.stdout.flush() - rt = obj_int.delete_file(file_name) - assert rt - - -if __name__ == "__main__": - setUp() - Test_object()