def setUp(self): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey from ddbmock import main app = main({}) from webtest import TestApp self.app = TestApp(app) dynamodb.hard_reset() hash_key = PrimaryKey(TABLE_HK_NAME, TABLE_HK_TYPE) range_key = PrimaryKey(TABLE_RK_NAME, TABLE_RK_TYPE) self.t1 = Table(TABLE_NAME1, TABLE_RT, TABLE_WT, hash_key, range_key) self.t2 = Table(TABLE_NAME2, TABLE_RT, TABLE_WT, hash_key, None) dynamodb.data[TABLE_NAME1] = self.t1 dynamodb.data[TABLE_NAME2] = self.t2 self.t1.put(ITEM1, {}) self.t1.put(ITEM2, {}) self.t1.put(ITEM3, {}) self.t2.put(ITEM4, {}) self.t2.put(ITEM5, {})
def setUp(self): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey dynamodb.hard_reset() hash_key = PrimaryKey(TABLE_HK_NAME, TABLE_HK_TYPE) range_key = PrimaryKey(TABLE_RK_NAME, TABLE_RK_TYPE) t1 = Table(TABLE_NAME , TABLE_RT, TABLE_WT, hash_key, range_key, status="ACTIVE") t2 = Table(TABLE_NAME2, TABLE_RT, TABLE_WT, hash_key, range_key) dynamodb.data[TABLE_NAME] = t1 dynamodb.data[TABLE_NAME2] = t2
def setUp(self): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey dynamodb.hard_reset() hash_key = PrimaryKey('hash_key', 'N') range_key = PrimaryKey('range_key', 'S') t1 = Table(TABLE_NAME1, 10, 10, hash_key, range_key) t2 = Table(TABLE_NAME2, 10, 10, hash_key, range_key) dynamodb.data[TABLE_NAME1] = t1 dynamodb.data[TABLE_NAME2] = t2
def setUp(self): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey from ddbmock import main app = main({}) from webtest import TestApp self.app = TestApp(app) dynamodb.hard_reset() hash_key = PrimaryKey(TABLE_HK_NAME, TABLE_HK_TYPE) range_key = PrimaryKey(TABLE_RK_NAME, TABLE_RK_TYPE) self.t1 = Table(TABLE_NAME, TABLE_RT, TABLE_WT, hash_key, range_key) dynamodb.data[TABLE_NAME] = self.t1
def setUp(self): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey dynamodb.hard_reset() hash_key = PrimaryKey(TABLE_HK_NAME, TABLE_HK_TYPE) range_key = PrimaryKey(TABLE_RK_NAME, TABLE_RK_TYPE) t1 = Table(TABLE_NAME, TABLE_RT, TABLE_WT, hash_key, range_key, status='ACTIVE') t1.put(ITEM1, {}) t1.put(ITEM2, {}) dynamodb.data[TABLE_NAME] = t1
def setUp(self): from ddbmock import connect_boto_patch from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey # Do a full database wipe dynamodb.hard_reset() # Instanciate the keys hash_key = PrimaryKey(self.TABLE_HK_NAME, self.TABLE_HK_TYPE) # Create a test table new_table = Table(self.TABLE_NAME, self.TABLE_RT, self.TABLE_WT, hash_key, None) # Very important: register the table in the DB dynamodb.data[self.TABLE_NAME] = new_table # Create the database connection ie: patch boto self.db = connect_boto_patch() self.table = self.db.get_table(self.TABLE_NAME) self.sns_conn = boto.connect_sns() self.memon = MEMon() self.memon.debug = False self.memon.table = self.table self.memon.sns_conn = self.sns_conn self.memon.server_time = False
def setUp(self, m_time): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey from ddbmock import main app = main({}) from webtest import TestApp self.app = TestApp(app) m_time.time.return_value = NOW dynamodb.hard_reset() hash_key = PrimaryKey(TABLE_HK_NAME, TABLE_HK_TYPE) range_key = PrimaryKey(TABLE_RK_NAME, TABLE_RK_TYPE) t1 = Table(TABLE_NAME, TABLE_RT, TABLE_WT, hash_key, range_key, status='ACTIVE') dynamodb.data[TABLE_NAME] = t1
def setUp(self): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey dynamodb.hard_reset() hash_key = PrimaryKey(TABLE_HK_NAME, TABLE_HK_TYPE) range_key = PrimaryKey(TABLE_RK_NAME, TABLE_RK_TYPE) self.t1 = Table(TABLE_NAME, TABLE_RT, TABLE_WT, hash_key, range_key) self.t2 = Table(TABLE_NAME2, TABLE_RT, TABLE_WT, hash_key, None) dynamodb.data[TABLE_NAME] = self.t1 dynamodb.data[TABLE_NAME2] = self.t2 self.t1.put(cp(ITEM), {}) self.t2.put(cp(ITEM2), {})
def setUp(self): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey dynamodb.hard_reset() hash_key = PrimaryKey(TABLE_HK_NAME, TABLE_HK_TYPE) range_key = PrimaryKey(TABLE_RK_NAME, TABLE_RK_TYPE) self.t1 = Table(TABLE_NAME, TABLE_RT, TABLE_WT, hash_key, range_key) dynamodb.data[TABLE_NAME] = self.t1 self.t1.put(ITEM1, {}) self.t1.put(ITEM2, {}) self.t1.put(ITEM3, {}) self.t1.put(ITEM4, {}) self.t1.put(ITEM5, {})
def setUp(self): from ddbmock.database.db import dynamodb from ddbmock.database.table import Table from ddbmock.database.key import PrimaryKey from ddbmock import main app = main({}) from webtest import TestApp self.app = TestApp(app) dynamodb.hard_reset() hash_key = PrimaryKey('hash_key', 'N') range_key = PrimaryKey('range_key', 'S') t1 = Table(TABLE_NAME1, 10, 10, hash_key, range_key) t2 = Table(TABLE_NAME2, 10, 10, hash_key, range_key) dynamodb.data[TABLE_NAME1] = t1 dynamodb.data[TABLE_NAME2] = t2