Merge pull request #744 from helenst/scan-after-has-item
Fix failure of scan() after has_item()
This commit is contained in:
		
						commit
						2fdc5498b5
					
				| @ -278,7 +278,7 @@ class DynamoHandler(BaseResponse): | |||||||
| 
 | 
 | ||||||
|         result = { |         result = { | ||||||
|             "Count": len(items), |             "Count": len(items), | ||||||
|             "Items": [item.attrs for item in items], |             "Items": [item.attrs for item in items if item], | ||||||
|             "ConsumedCapacityUnits": 1, |             "ConsumedCapacityUnits": 1, | ||||||
|             "ScannedCount": scanned_count |             "ScannedCount": scanned_count | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -419,6 +419,17 @@ def test_scan_with_undeclared_table(): | |||||||
|     ).should.throw(DynamoDBResponseError) |     ).should.throw(DynamoDBResponseError) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @mock_dynamodb | ||||||
|  | def test_scan_after_has_item(): | ||||||
|  |     conn = boto.connect_dynamodb() | ||||||
|  |     table = create_table(conn) | ||||||
|  |     list(table.scan()).should.equal([]) | ||||||
|  | 
 | ||||||
|  |     table.has_item(hash_key='the-key', range_key='123') | ||||||
|  | 
 | ||||||
|  |     list(table.scan()).should.equal([]) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| @mock_dynamodb | @mock_dynamodb | ||||||
| def test_write_batch(): | def test_write_batch(): | ||||||
|     conn = boto.connect_dynamodb() |     conn = boto.connect_dynamodb() | ||||||
|  | |||||||
| @ -335,6 +335,17 @@ def test_scan_with_undeclared_table(): | |||||||
|     ).should.throw(DynamoDBResponseError) |     ).should.throw(DynamoDBResponseError) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @mock_dynamodb | ||||||
|  | def test_scan_after_has_item(): | ||||||
|  |     conn = boto.connect_dynamodb() | ||||||
|  |     table = create_table(conn) | ||||||
|  |     list(table.scan()).should.equal([]) | ||||||
|  | 
 | ||||||
|  |     table.has_item('the-key') | ||||||
|  | 
 | ||||||
|  |     list(table.scan()).should.equal([]) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| @mock_dynamodb | @mock_dynamodb | ||||||
| def test_write_batch(): | def test_write_batch(): | ||||||
|     conn = boto.connect_dynamodb() |     conn = boto.connect_dynamodb() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user