Exemplo n.º 1
0
 def test_nested_sections(self):
     bank = self._create_test_bank()
     top_section = BankSection(bank, "/top")
     mid_section = top_section.get_sub_section("/mid")
     bottom_section = mid_section.get_sub_section("/bottom")
     bottom_section.create_object("key", "value")
     self.assertEqual(bank.get_object("/top/mid/bottom/key"), "value")
Exemplo n.º 2
0
 def test_nested_sections(self):
     bank = self._create_test_bank()
     top_section = BankSection(bank, "/top")
     mid_section = top_section.get_sub_section("/mid")
     bottom_section = mid_section.get_sub_section("/bottom")
     bottom_section.create_object("key", "value")
     self.assertEqual(bank.get_object("/top/mid/bottom/key"), "value")
Exemplo n.º 3
0
    def test_nested_sections_list(self):
        bank = self._create_test_bank()
        top_section = BankSection(bank, "/top")
        mid_section = top_section.get_sub_section("/mid")
        bottom_section = mid_section.get_sub_section("/bottom")
        keys = ["KeyA", "KeyB", "KeyC"]
        for key in keys:
            bottom_section.update_object(key, "value")

        list_result = set(bottom_section.list_objects(prefix="Key"))
        self.assertEqual(set(keys), list_result)
        self.assertEqual(
            keys[:2],
            list(bottom_section.list_objects("/", limit=2)))
        self.assertEqual(
            keys[2:4],
            list(bottom_section.list_objects("/", limit=2, marker="KeyB")))