Source

dynamodb-mock / tests / functional / boto / test_scan.py

Diff from to

tests/functional/boto/test_scan.py

         ret = db.layer1.scan(TABLE_NAME, None)
         self.assertEqual(expected, ret)
 
+    def test_scan_paged(self):
+        from ddbmock import connect_boto_patch
+        from ddbmock.database.db import dynamodb
+        from boto.dynamodb.exceptions import DynamoDBValidationError
+
+        esk = {
+            u'HashKeyElement': {u'N': u'789'},
+            u'RangeKeyElement': {u'S': u'Waldo-5'},
+        }
+
+        expected1 = {
+            u"Count": 4,
+            u"ScannedCount": 4,
+            u"Items": [ITEM2, ITEM1, ITEM6, ITEM5],
+            u"ConsumedCapacityUnits": 1.5,
+            u'LastEvaluatedKey': esk,
+        }
+        expected2 = {
+            u"Count": 2,
+            u"ScannedCount": 2,
+            u"Items": [ITEM4, ITEM3],
+            u"ConsumedCapacityUnits": 0.5,
+        }
+
+        db = connect_boto_patch()
+
+        ret = db.layer1.scan(TABLE_NAME, limit=4)
+        self.assertEqual(expected1, ret)
+        ret = db.layer1.scan(TABLE_NAME, exclusive_start_key=esk)
+        self.assertEqual(expected2, ret)
+
     def test_scan_all_filter_fields(self):
         from ddbmock import connect_boto_patch
         from ddbmock.database.db import dynamodb
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.