54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| import boto
 | |
| 
 | |
| from freezegun import freeze_time
 | |
| 
 | |
| from moto import mock_dynamodb
 | |
| from moto.dynamodb import dynamodb_backend
 | |
| 
 | |
| 
 | |
| @mock_dynamodb
 | |
| def test_list_tables():
 | |
|     name = 'TestTable'
 | |
|     dynamodb_backend.create_table(name)
 | |
|     conn = boto.connect_dynamodb('the_key', 'the_secret')
 | |
|     assert conn.list_tables() == ['TestTable']
 | |
| 
 | |
| 
 | |
| @freeze_time("2012-01-14")
 | |
| @mock_dynamodb
 | |
| def test_describe_table():
 | |
|     dynamodb_backend.create_table('messages',
 | |
|         hash_key_attr='forum_name',
 | |
|         hash_key_type='S',
 | |
|         range_key_attr='subject',
 | |
|         range_key_type='S',
 | |
|         read_capacity=10,
 | |
|         write_capacity=10,
 | |
|     )
 | |
|     conn = boto.connect_dynamodb('the_key', 'the_secret')
 | |
|     expected = {
 | |
|                 'Table': {
 | |
|                     'CreationDateTime': 1326499200.0,
 | |
|                     'ItemCount': 0,
 | |
|                     'KeySchema': {
 | |
|                         'HashKeyElement': {
 | |
|                             'AttributeName': 'forum_name',
 | |
|                             'AttributeType': 'S'
 | |
|                         },
 | |
|                         'RangeKeyElement': {
 | |
|                             'AttributeName': 'subject',
 | |
|                             'AttributeType': 'S'
 | |
|                         }
 | |
|                     },
 | |
|                     'ProvisionedThroughput': {
 | |
|                         'ReadCapacityUnits': 10,
 | |
|                         'WriteCapacityUnits': 10
 | |
|                     },
 | |
|                     'TableName': 'messages',
 | |
|                     'TableSizeBytes': 0,
 | |
|                     'TableStatus': 'ACTIVE'
 | |
|                 }
 | |
|             }
 | |
|     import pdb; pdb.set_trace()
 | |
|     assert conn.describe_table('messages') == expected
 |