예제 #1
0
파일: test_memon.py 프로젝트: so-sure/MEMon
    def tearDown(self):
        from ddbmock.database.db import dynamodb
        from ddbmock import clean_boto_patch

        # Do a full database wipe
        dynamodb.hard_reset()

        # Remove the patch from Boto code (if any)
        clean_boto_patch()
예제 #2
0
파일: test_memon.py 프로젝트: urg/MEMon
    def tearDown(self):
        from ddbmock.database.db import dynamodb
        from ddbmock import clean_boto_patch

        # Do a full database wipe
        dynamodb.hard_reset()

        # Remove the patch from Boto code (if any)
        clean_boto_patch()
예제 #3
0
    def test_connect_boto_patch_network(self):
        from ddbmock import connect_boto_network, clean_boto_patch

        clean_boto_patch()
        db = connect_boto_network(HOST, PORT)

        self.assertEqual('ddbmock', db.layer1.region.name)
        self.assertEqual(ENDPOINT, db.layer1.region.endpoint)
        self.assertEqual(ENDPOINT, db.layer1.host)
        self.assertEqual(PORT, db.layer1.port)
        self.assertFalse(db.layer1.is_secure)
예제 #4
0
    def test_connect_boto_patch_network(self):
        try:
            socket.gethostbyname(HOST)
        except Exception:
            self.skipTest("Can't connect to test host: %s" % HOST)

        from ddbmock import connect_boto_network, clean_boto_patch

        clean_boto_patch()
        db = connect_boto_network(HOST, PORT)

        self.assertEqual('ddbmock', db.layer1.region.name)
        self.assertEqual(ENDPOINT, db.layer1.region.endpoint)
        self.assertEqual(ENDPOINT, db.layer1.host)
        self.assertEqual(PORT, db.layer1.port)
        self.assertFalse(db.layer1.is_secure)
예제 #5
0
 def tearDown(self):
     from ddbmock.database.db import dynamodb
     from ddbmock import clean_boto_patch
     dynamodb.hard_reset()
     clean_boto_patch()
예제 #6
0
import sys

# Just, skip this unless "--no-skip"
if '--no-skip' in sys.argv:
    import os, imp, boto, unittest
    from ddbmock import connect_boto_patch, clean_boto_patch

    # Load boto dir
    boto_dir = os.path.realpath(boto.__file__+'/../../')

    # Plug patch
    connect_boto_patch()

    # Import boto test modules, pretending they are belonging to us. see hack in tests.unit.__init__
    layer1_file, _, desc1 = imp.find_module('test_layer1', [boto_dir+'/tests/integration/dynamodb'])
    layer2_file, _, desc2 = imp.find_module('test_layer2', [boto_dir+'/tests/integration/dynamodb'])
    layer1_module = imp.load_module('test_layer1', layer1_file, boto_dir, desc1)
    layer2_module = imp.load_module('test_layer2', layer2_file, boto_dir, desc2)

    # Finally, import the tests class, that's enough to let the magic happen !
    DynamoDBLayer1Test = layer1_module.DynamoDBLayer1Test
    DynamoDBLayer2Test = layer2_module.DynamoDBLayer2Test

    # clean up
    layer1_file.close()
    layer2_file.close()
    clean_boto_patch()
else:
    print "Boto Integration tests are slow hence disabled by default, enable them with '--no-skip'"

예제 #7
0
 def tearDown(self):
     from ddbmock import clean_boto_patch
     clean_boto_patch()
예제 #8
0
 def tearDown(self):
     from ddbmock import clean_boto_patch
     clean_boto_patch()