Exemple #1
0
 def test_list_objects(self):
     bank = self._create_test_bank()
     section = BankSection(bank, "/prefix", is_writable=True)
     bank.create_object("/prefix/a", "value")
     bank.create_object("/prefixd", "value")  # Should not appear
     section.create_object("/b", "value")
     section.create_object("c", "value")
     expected_result = ["a", "b", "c"]
     self.assertEqual(list(section.list_objects("/")), expected_result)
     self.assertEqual(list(section.list_objects("///")), expected_result)
     self.assertEqual(list(section.list_objects(None)), expected_result)
     self.assertEqual(
         list(section.list_objects("/", limit=2)),
         expected_result[:2],
     )
     self.assertEqual(
         list(section.list_objects("/", limit=2, marker="b")),
         expected_result[2:4],
     )
Exemple #2
0
 def test_list_objects(self):
     bank = self._create_test_bank()
     section = BankSection(bank, "/prefix", is_writable=True)
     bank.create_object("/prefix/a", "value")
     bank.create_object("/prefixd", "value")  # Should not appear
     section.create_object("/b", "value")
     section.create_object("c", "value")
     expected_result = ["a", "b", "c"]
     self.assertEqual(list(section.list_objects("/")), expected_result)
     self.assertEqual(list(section.list_objects("///")), expected_result)
     self.assertEqual(list(section.list_objects(None)), expected_result)
     self.assertEqual(
         list(section.list_objects("/", limit=2)),
         expected_result[:2],
     )
     self.assertEqual(
         list(section.list_objects("/", limit=2, marker="b")),
         expected_result[2:4],
     )
Exemple #3
0
 def test_list_objects_with_extra_prefix_and_marker(self):
     bank = self._create_test_bank()
     section = BankSection(bank, "/prefix", is_writable=True)
     section.update_object("prefix1/KeyA", "value")
     section.update_object("prefix2/KeyB", "value")
     section.update_object("prefix2/KeyC", "value")
     expected_result = ["prefix2/KeyC"]
     self.assertEqual(
         expected_result,
         list(section.list_objects('/prefix2/', marker="KeyB"))
     )
Exemple #4
0
 def test_list_objects(self):
     bank = self._create_test_bank()
     section = BankSection(bank, "/prefix", is_writable=True)
     bank.update_object("/prefix/KeyA", "value")
     bank.update_object("/prefix", "value")
     bank.update_object("/prefixKeyD", "value")  # Should not appear
     section.update_object("/KeyB", "value")
     section.update_object("KeyC", "value")
     expected_result = ["KeyA", "KeyB", "KeyC"]
     self.assertEqual(expected_result, list(section.list_objects("/")))
     self.assertEqual(expected_result, list(section.list_objects("///")))
     self.assertEqual(expected_result, list(section.list_objects(None)))
     self.assertEqual(expected_result, list(section.list_objects("Key")))
     self.assertEqual(
         expected_result[:2],
         list(section.list_objects("/", limit=2)))
     self.assertEqual(
         expected_result[2:4],
         list(section.list_objects("/", limit=2, marker="KeyB")))