Exemplo n.º 1
0
    def test_load_and_save_stack(self):
        cs = CallStack(self.test_load_and_save_stack)

        h1 = Hook('fake-hash2', callback2)
        h2 = Hook('fake-hash3', callback3)

        cs.add_hook(h1)
        cs.add_hook(h2)

        assert len(cs.hooks) == 2
        assert len(cs.calls) == 0
        assert cs.hooks['fake-hash2'].hash == 'fake-hash2'
        assert cs.hooks['fake-hash3'].hash == 'fake-hash3'

        delete_stack(cs)

        save_stack(cs)
        loaded = load_stack(cs)

        assert len(loaded.hooks) == 2
        assert len(loaded.calls) == 0
        assert loaded.hooks['fake-hash2'].hash == 'fake-hash2'
        assert loaded.hooks['fake-hash3'].hash == 'fake-hash3'
Exemplo n.º 2
0
    def test_load_and_save_stack(self):
        cs = CallStack(self.test_load_and_save_stack)

        h1 = Hook("fake-hash2", callback2)
        h2 = Hook("fake-hash3", callback3)

        cs.add_hook(h1)
        cs.add_hook(h2)

        assert len(cs.hooks) == 2
        assert len(cs.calls) == 0
        assert cs.hooks["fake-hash2"].hash == "fake-hash2"
        assert cs.hooks["fake-hash3"].hash == "fake-hash3"

        delete_stack(cs)

        save_stack(cs)
        loaded = load_stack(cs)

        assert len(loaded.hooks) == 2
        assert len(loaded.calls) == 0
        assert loaded.hooks["fake-hash2"].hash == "fake-hash2"
        assert loaded.hooks["fake-hash3"].hash == "fake-hash3"
    def test_load_and_save_stack(self):
        cs = CallStack(self.test_load_and_save_stack)

        h1 = Hook('fake-hash2', callback2)
        h2 = Hook('fake-hash3', callback3)

        cs.add_hook(h1)
        cs.add_hook(h2)

        assert len(cs.hooks) == 2
        assert len(cs.calls) == 0
        assert cs.hooks['fake-hash2'].hash == 'fake-hash2'
        assert cs.hooks['fake-hash3'].hash == 'fake-hash3'

        delete_stack(cs)

        save_stack(cs)
        loaded = load_stack(cs)

        assert len(loaded.hooks) == 2
        assert len(loaded.calls) == 0
        assert loaded.hooks['fake-hash2'].hash == 'fake-hash2'
        assert loaded.hooks['fake-hash3'].hash == 'fake-hash3'
Exemplo n.º 4
0
    def delete(self):
        """
        Deletes this stack from disk so a new one can be saved.

        """
        delete_stack(self)
Exemplo n.º 5
0
    def delete(self):
        """
        Deletes this stack from disk so a new one can be saved.

        """
        delete_stack(self)