Esempio n. 1
0
    def test_missing_record_contents(self):
        backend = RedisBackend()

        record_1 = Record('record:1', 'value', time.time())
        backend.add('timeline', record_1)
        backend._get_connection('timeline').delete('d:t:timeline:r:record:1')

        record_2 = Record('record:2', 'value', time.time())
        backend.add('timeline', record_2)

        # The existing and new record should be there because the timeline
        # contents were merged back into the digest.
        with backend.digest('timeline', 0) as records:
            assert set(records) == set([record_2])
    def test_missing_record_contents(self):
        backend = RedisBackend()

        record_1 = Record('record:1', 'value', time.time())
        backend.add('timeline', record_1)
        backend._get_connection('timeline').delete('d:t:timeline:r:record:1')

        record_2 = Record('record:2', 'value', time.time())
        backend.add('timeline', record_2)

        # The existing and new record should be there because the timeline
        # contents were merged back into the digest.
        with backend.digest('timeline', 0) as records:
            assert set(records) == set([record_2])
Esempio n. 3
0
    def test_missing_record_contents(self):
        backend = RedisBackend()

        record_1 = Record("record:1", "value", time.time())
        backend.add("timeline", record_1)
        backend._get_connection("timeline").delete("d:t:timeline:r:record:1")

        record_2 = Record("record:2", "value", time.time())
        backend.add("timeline", record_2)

        # The existing and new record should be there because the timeline
        # contents were merged back into the digest.
        with backend.digest("timeline", 0) as records:
            assert set(records) == {record_2}
Esempio n. 4
0
    def test_delete(self):
        backend = RedisBackend()
        backend.add('timeline', Record('record:1', 'value', time.time()))
        backend.delete('timeline')

        with pytest.raises(InvalidState):
            with backend.digest('timeline', 0) as records:
                assert set(records) == set([])

        assert set(backend.schedule(time.time())) == set()
        assert len(backend._get_connection('timeline').keys('d:*')) == 0
    def test_delete(self):
        backend = RedisBackend()
        backend.add('timeline', Record('record:1', 'value', time.time()))
        backend.delete('timeline')

        with pytest.raises(InvalidState):
            with backend.digest('timeline', 0) as records:
                assert set(records) == set([])

        assert set(backend.schedule(time.time())) == set()
        assert len(backend._get_connection('timeline').keys('d:*')) == 0
Esempio n. 6
0
    def test_delete(self):
        backend = RedisBackend()
        backend.add("timeline", Record("record:1", "value", time.time()))
        backend.delete("timeline")

        with pytest.raises(InvalidState):
            with backend.digest("timeline", 0) as records:
                assert set(records) == set()

        assert set(backend.schedule(time.time())) == set()
        assert len(backend._get_connection("timeline").keys("d:*")) == 0