| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2006-2011 Mitch Garnaat http://garnaat.org/ | 2 # Copyright (c) 2006-2011 Mitch Garnaat http://garnaat.org/ |
| 3 # | 3 # |
| 4 # Permission is hereby granted, free of charge, to any person obtaining a | 4 # Permission is hereby granted, free of charge, to any person obtaining a |
| 5 # copy of this software and associated documentation files (the | 5 # copy of this software and associated documentation files (the |
| 6 # "Software"), to deal in the Software without restriction, including | 6 # "Software"), to deal in the Software without restriction, including |
| 7 # without limitation the rights to use, copy, modify, merge, publish, dis- | 7 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 8 # tribute, sublicense, and/or sell copies of the Software, and to permit | 8 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 9 # persons to whom the Software is furnished to do so, subject to the fol- | 9 # persons to whom the Software is furnished to do so, subject to the fol- |
| 10 # lowing conditions: | 10 # lowing conditions: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 """ | 25 """ |
| 26 | 26 |
| 27 import logging | 27 import logging |
| 28 import sys | 28 import sys |
| 29 import unittest | 29 import unittest |
| 30 import getopt | 30 import getopt |
| 31 | 31 |
| 32 from sqs.test_connection import SQSConnectionTest | 32 from sqs.test_connection import SQSConnectionTest |
| 33 from s3.test_connection import S3ConnectionTest | 33 from s3.test_connection import S3ConnectionTest |
| 34 from s3.test_versioning import S3VersionTest | 34 from s3.test_versioning import S3VersionTest |
| 35 from s3.test_mfa import S3MFATest |
| 36 from s3.test_encryption import S3EncryptionTest |
| 37 from s3.test_bucket import S3BucketTest |
| 38 from s3.test_key import S3KeyTest |
| 39 from s3.test_multidelete import S3MultiDeleteTest |
| 40 from s3.test_multipart import S3MultiPartUploadTest |
| 35 from s3.test_gsconnection import GSConnectionTest | 41 from s3.test_gsconnection import GSConnectionTest |
| 36 from s3.test_https_cert_validation import CertValidationTest | 42 from s3.test_https_cert_validation import CertValidationTest |
| 43 from s3.test_resumable_downloads import ResumableDownloadTests |
| 44 from s3.test_resumable_uploads import ResumableUploadTests |
| 37 from ec2.test_connection import EC2ConnectionTest | 45 from ec2.test_connection import EC2ConnectionTest |
| 46 from ec2.elb.test_connection import ELBConnectionTest |
| 47 from ec2.cloudwatch.test_connection import CloudWatchConnectionTest |
| 38 from autoscale.test_connection import AutoscaleConnectionTest | 48 from autoscale.test_connection import AutoscaleConnectionTest |
| 39 from sdb.test_connection import SDBConnectionTest | 49 from sdb.test_connection import SDBConnectionTest |
| 50 from cloudfront.test_signed_urls import CloudfrontSignedUrlsTest |
| 51 from dynamodb.test_layer1 import DynamoDBLayer1Test |
| 52 from dynamodb.test_layer2 import DynamoDBLayer2Test |
| 53 from sts.test_session_token import SessionTokenTest |
| 40 | 54 |
| 41 def usage(): | 55 def usage(): |
| 42 print "test.py [-t testsuite] [-v verbosity]" | 56 print "test.py [-t testsuite] [-v verbosity]" |
| 43 print " -t run specific testsuite (s3|ssl|s3ver|s3nover|gs|sqs|ec2|sdb|
all)" | 57 print " -t run specific testsuite (s3|ssl|s3mfa|gs|sqs|ec2|sdb|dynamodb
|dynamodbL1|dynamodbL2|sts|all)" |
| 44 print " -v verbosity (0|1|2)" | 58 print " -v verbosity (0|1|2)" |
| 45 | 59 |
| 46 def main(): | 60 def main(): |
| 47 try: | 61 try: |
| 48 opts, args = getopt.getopt(sys.argv[1:], "ht:v:", | 62 opts, args = getopt.getopt(sys.argv[1:], "ht:v:", |
| 49 ["help", "testsuite", "verbosity"]) | 63 ["help", "testsuite", "verbosity"]) |
| 50 except: | 64 except: |
| 51 usage() | 65 usage() |
| 52 sys.exit(2) | 66 sys.exit(2) |
| 53 testsuite = "all" | 67 testsuite = "all" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 73 unittest.TextTestRunner(verbosity=verbosity).run(tests) | 87 unittest.TextTestRunner(verbosity=verbosity).run(tests) |
| 74 | 88 |
| 75 def suite(testsuite="all"): | 89 def suite(testsuite="all"): |
| 76 tests = unittest.TestSuite() | 90 tests = unittest.TestSuite() |
| 77 if testsuite == "all": | 91 if testsuite == "all": |
| 78 tests.addTest(unittest.makeSuite(SQSConnectionTest)) | 92 tests.addTest(unittest.makeSuite(SQSConnectionTest)) |
| 79 tests.addTest(unittest.makeSuite(S3ConnectionTest)) | 93 tests.addTest(unittest.makeSuite(S3ConnectionTest)) |
| 80 tests.addTest(unittest.makeSuite(EC2ConnectionTest)) | 94 tests.addTest(unittest.makeSuite(EC2ConnectionTest)) |
| 81 tests.addTest(unittest.makeSuite(SDBConnectionTest)) | 95 tests.addTest(unittest.makeSuite(SDBConnectionTest)) |
| 82 tests.addTest(unittest.makeSuite(AutoscaleConnectionTest)) | 96 tests.addTest(unittest.makeSuite(AutoscaleConnectionTest)) |
| 97 tests.addTest(unittest.makeSuite(CloudfrontSignedUrlsTest)) |
| 98 tests.addTest(unittest.makeSuite(DynamoDBLayer1Test)) |
| 99 tests.addTest(unittest.makeSuite(DynamoDBLayer2Test)) |
| 83 elif testsuite == "s3": | 100 elif testsuite == "s3": |
| 84 tests.addTest(unittest.makeSuite(S3ConnectionTest)) | 101 tests.addTest(unittest.makeSuite(S3ConnectionTest)) |
| 102 tests.addTest(unittest.makeSuite(S3BucketTest)) |
| 103 tests.addTest(unittest.makeSuite(S3KeyTest)) |
| 104 tests.addTest(unittest.makeSuite(S3MultiPartUploadTest)) |
| 85 tests.addTest(unittest.makeSuite(S3VersionTest)) | 105 tests.addTest(unittest.makeSuite(S3VersionTest)) |
| 106 tests.addTest(unittest.makeSuite(S3EncryptionTest)) |
| 107 tests.addTest(unittest.makeSuite(S3MultiDeleteTest)) |
| 86 elif testsuite == "ssl": | 108 elif testsuite == "ssl": |
| 87 tests.addTest(unittest.makeSuite(CertValidationTest)) | 109 tests.addTest(unittest.makeSuite(CertValidationTest)) |
| 88 elif testsuite == "s3ver": | 110 elif testsuite == "s3mfa": |
| 89 tests.addTest(unittest.makeSuite(S3VersionTest)) | 111 tests.addTest(unittest.makeSuite(S3MFATest)) |
| 90 elif testsuite == "s3nover": | |
| 91 tests.addTest(unittest.makeSuite(S3ConnectionTest)) | |
| 92 elif testsuite == "gs": | 112 elif testsuite == "gs": |
| 93 tests.addTest(unittest.makeSuite(GSConnectionTest)) | 113 tests.addTest(unittest.makeSuite(GSConnectionTest)) |
| 114 tests.addTest(unittest.makeSuite(ResumableDownloadTests)) |
| 115 tests.addTest(unittest.makeSuite(ResumableUploadTests)) |
| 94 elif testsuite == "sqs": | 116 elif testsuite == "sqs": |
| 95 tests.addTest(unittest.makeSuite(SQSConnectionTest)) | 117 tests.addTest(unittest.makeSuite(SQSConnectionTest)) |
| 96 elif testsuite == "ec2": | 118 elif testsuite == "ec2": |
| 97 tests.addTest(unittest.makeSuite(EC2ConnectionTest)) | 119 tests.addTest(unittest.makeSuite(EC2ConnectionTest)) |
| 120 tests.addTest(unittest.makeSuite(AutoscaleConnectionTest)) |
| 121 tests.addTest(unittest.makeSuite(ELBConnectionTest)) |
| 122 tests.addTest(unittest.makeSuite(CloudWatchConnectionTest)) |
| 98 elif testsuite == "autoscale": | 123 elif testsuite == "autoscale": |
| 99 tests.addTest(unittest.makeSuite(AutoscaleConnectionTest)) | 124 tests.addTest(unittest.makeSuite(AutoscaleConnectionTest)) |
| 100 elif testsuite == "sdb": | 125 elif testsuite == "sdb": |
| 101 tests.addTest(unittest.makeSuite(SDBConnectionTest)) | 126 tests.addTest(unittest.makeSuite(SDBConnectionTest)) |
| 127 elif testsuite == "cloudfront": |
| 128 tests.addTest(unittest.makeSuite(CloudfrontSignedUrlsTest)) |
| 129 elif testsuite == "dynamodb": |
| 130 tests.addTest(unittest.makeSuite(DynamoDBLayer1Test)) |
| 131 tests.addTest(unittest.makeSuite(DynamoDBLayer2Test)) |
| 132 elif testsuite == "dynamodbL1": |
| 133 tests.addTest(unittest.makeSuite(DynamoDBLayer1Test)) |
| 134 elif testsuite == "dynamodbL2": |
| 135 tests.addTest(unittest.makeSuite(DynamoDBLayer2Test)) |
| 136 elif testsuite == "sts": |
| 137 tests.addTest(unittest.makeSuite(SessionTokenTest)) |
| 102 else: | 138 else: |
| 103 raise ValueError("Invalid choice.") | 139 raise ValueError("Invalid choice.") |
| 104 return tests | 140 return tests |
| 105 | 141 |
| 106 if __name__ == "__main__": | 142 if __name__ == "__main__": |
| 107 main() | 143 main() |
| OLD | NEW |