Implement upcoming query on store

This commit is contained in:
lash 2022-03-13 15:45:48 +00:00
parent a6e48d93a8
commit 04dfb185ce
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 13 additions and 1 deletions

View File

@ -95,3 +95,8 @@ class Store:
entry.retry() entry.retry()
except StateTransitionInvalid: except StateTransitionInvalid:
entry.readysend() entry.readysend()
def fail(self, k):
entry = QueueEntry(self, k)
entry.reject()

View File

@ -43,7 +43,7 @@ class TestIntegrateBase(TestShepBase):
self.store.put(b'foo'.hex(), b'bar'.hex(), cache_adapter=MockCacheTokenTx) self.store.put(b'foo'.hex(), b'bar'.hex(), cache_adapter=MockCacheTokenTx)
def test_state_move(self): def test_state_enqueu(self):
hx = b'foo'.hex() hx = b'foo'.hex()
self.store.put(hx, b'bar'.hex(), cache_adapter=MockCacheTokenTx) self.store.put(hx, b'bar'.hex(), cache_adapter=MockCacheTokenTx)
self.store.get(hx) self.store.get(hx)
@ -53,5 +53,12 @@ class TestIntegrateBase(TestShepBase):
self.assertEqual(v[0], hx) self.assertEqual(v[0], hx)
def test_state_defer(self):
hx = b'foo'.hex()
self.store.put(hx, b'bar'.hex(), cache_adapter=MockCacheTokenTx)
self.store.get(hx)
self.store.fail(hx)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()