예제 #1
0
class SDBClientMethodTesting(TestCase):
    def setUp(self):
        self.sdb = SimpleDBClient('sdb.amazonaws.com', access_key, secret_key)

    def test_1(self):
        #create a domain
        newdomainename = "awsutilsunittest_%s"%(int(time.time()))

        self.sdb.createDomain(newdomainename)

        #idempotent will not fail
        self.sdb.createDomain(newdomainename)

        domainnames = self.sdb.listDomains()
        self.assertIsInstance(domainnames, list)
        if newdomainename not in domainnames:
            self.fail("can't find domain %s just created"%(newdomainename,))

        meta = self.sdb.domainMetadata(newdomainename)
        self.assertIsInstance(meta, dict)

        self.assertTrue('Timestamp' in meta)
        self.assertTrue('AttributeValueCount' in meta)
        self.assertTrue('AttributeValuesSizeBytes' in meta)
        self.assertTrue('ItemNamesSizeBytes' in meta)
        self.assertTrue('AttributeNameCount' in meta)
        self.assertTrue('ItemCount' in meta)
        self.assertTrue('AttributeNamesSizeBytes' in meta)

        self.sdb.deleteDomain(newdomainename)

        with self.assertRaises(NoSuchDomain):
            self.sdb.domainMetadata(newdomainename)
예제 #2
0
 def setUp(self):
     self.sdb = SimpleDBClient('sdb.amazonaws.com', access_key, secret_key)