def store(monkeypatch): local_store = HeartbeatStore() @classmethod def scoped_store(*args, **kwargs): return local_store # Circumvent singleton behaviour for tests monkeypatch.setattr("inbox.heartbeat.store.HeartbeatStore.store", scoped_store) return HeartbeatStore.store()
def test_kill_device_multiple(): # If we kill a device and the folder has multiple devices, don't clear # the heartbeat status local_store = HeartbeatStore().store() proxy_for(1, 2, device_id=2).publish() proxy_for(1, 2, device_id=3).publish() clear_heartbeat_status(1, device_id=2) folders = local_store.get_account_folders(1) assert len(folders) == 1 f, ts = folders[0] assert f.decode() == "2"