def test_adapter_cant_change_its_bridge(detached_integration): a1 = SampleAdapter('a1') a2 = SampleAdapter('a2') a3 = SampleAdapter('a3') SyncBridge(detached_integration, a1, a2) with pytest.raises(RuntimeError): SyncBridge(detached_integration, a2, a3)
def on_task_deleted(sender, user=None, service=None, integration=None, obj=None, **kwargs): # let's see if we have to keep track of this guid = integration.settings.get('projects_notebooks', {}).get(obj['project_id']) if guid is None: return td = TodoistSyncAdapter(obj['project_id']) ev = EvernoteSyncAdapter(guid) bridge = SyncBridge(integration, td, ev) bridge.delete_task(td, obj['id'])
def on_task_changed(sender, integration=None, obj=None, **kwargs): td = TodoistSyncAdapter(obj['project_id']) gc = GcalSyncAdapter() bridge = SyncBridge(integration, td, gc) # we delete tasks, if they're marked as "in history" if obj['in_history']: bridge.delete_task(td, obj['id']) else: bridge.push_task(td, obj['id'], obj)
def on_task_deleted(sender, integration=None, obj=None, **kwargs): td = TodoistSyncAdapter(obj['project_id']) gc = GcalSyncAdapter() bridge = SyncBridge(integration, td, gc) bridge.delete_task(td, obj['id'])
def build_bridge(integration, project_id, notebook_guid): td = TodoistSyncAdapter(project_id) ev = EvernoteSyncAdapter(notebook_guid) return SyncBridge(integration, td, ev)
def dumb_bridge(detached_integration, td, dumb): return SyncBridge(detached_integration, td, dumb)
def bridge(detached_integration, td, gh): return SyncBridge(detached_integration, td, gh)