def test_record_not_in_batch(self): dy = DynamoBatchDispatcher('test_table_name', 'p_key', max_batch_size=1) dy._batch_payload = [{'PutRequest': {'Item': {'p_key': 'cde'}}}] test_payload = {'p_key': 'abc'} self.assertTrue( dy._check_payload_is_unique_by_partition_key(test_payload))
def test_empty_batch(self): dy = DynamoBatchDispatcher('test_table_name', 'p_key', max_batch_size=1) dy._batch_payload = [] test_payload = {'p_key': 'abc'} self.assertTrue( dy._check_payload_is_unique_by_partition_key(test_payload))
def test_sort_key_and_partition_key_in_batch(self): dy = DynamoBatchDispatcher('test_table_name', 'p_key', max_batch_size=1, sort_key='s_key') dy._batch_payload = [{ 'PutRequest': { 'Item': { 'p_key': 'abc', 's_key': 'def' } } }] test_payload = {'p_key': 'abc', 's_key': 'def'} self.assertFalse( dy._check_payload_is_unique_by_partition_key_and_sort_key( test_payload))