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")) )
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")))