~tribaal/txaws/xss-hardening

« back to all changes in this revision

Viewing changes to txaws/testing/service.py

  • Committer: Duncan McGreggor
  • Date: 2009-08-28 02:32:44 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: duncan@canonical.com-20090828023244-6t44fi741heukb8p
- Fixed the creds parameter in the get_ec2_client method.
- Removed redundant code in check_parsed_instances.
- Created a testing subpackage for generally useful testing classes.
- Added fake ec2 client and region classes.
- Moved base test case into new testing module.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from txaws.credentials import AWSCredentials
 
2
from txaws.service import AWSServiceEndpoint
 
3
from txaws.testing.ec2 import FakeEC2Client
 
4
 
 
5
 
 
6
class FakeAWSServiceRegion(object):
 
7
 
 
8
    instances = []
 
9
 
 
10
    def __init__(self, access_key="", secret_key="", uri=""):
 
11
        self.access_key = access_key
 
12
        self.secret_key = secret_key
 
13
        self.uri = uri
 
14
 
 
15
    def get_ec2_client(self, *args, **kwds):
 
16
 
 
17
        creds = AWSCredentials(access_key=self.access_key,
 
18
                               secret_key=self.secret_key)
 
19
        endpoint = AWSServiceEndpoint(uri=self.uri)
 
20
        return FakeEC2Client(creds, endpoint, instances=self.instances)