MCPcopy Create free account
hub / github.com/LaunchPlatform/beanhub-cli / test_sync

Function test_sync

tests/connect/test_sync.py:66–142  ·  view source on GitHub ↗
(
    cli_runner: CliRunner,
    mock_config: Config,
    httpx_mock: HTTPXMock,
)

Source from the content-addressed store, hash-verified

64
65
66def test_sync(
67 cli_runner: CliRunner,
68 mock_config: Config,
69 httpx_mock: HTTPXMock,
70):
71 batch_id = uuid.uuid4()
72 httpx_mock.add_response(
73 url=f"https://api.beanhub.io/v1/repos/{mock_config.repo.default}/connect/sync_batches",
74 method="POST",
75 status_code=201,
76 json=dict(
77 id=str(batch_id),
78 ),
79 match_headers={"access-token": mock_config.access_token.token},
80 )
81 httpx_mock.add_response(
82 url=f"https://api.beanhub.io/v1/repos/{mock_config.repo.default}/connect/sync_batches/{batch_id}",
83 method="GET",
84 status_code=200,
85 json=_sync_batch_payload(
86 batch_id,
87 syncs=[
88 dict(
89 id="SYNC0",
90 state="PROCESSING",
91 item=dict(
92 id="MOCK_ITEM0",
93 institution_name="Chase",
94 ),
95 ),
96 dict(
97 id="SYNC1",
98 state="PROCESSING",
99 item=dict(
100 id="MOCK_ITEM1",
101 institution_name="Chase",
102 ),
103 ),
104 ],
105 ),
106 match_headers={"access-token": mock_config.access_token.token},
107 )
108 httpx_mock.add_response(
109 url=f"https://api.beanhub.io/v1/repos/{mock_config.repo.default}/connect/sync_batches/{batch_id}",
110 method="GET",
111 status_code=200,
112 json=_sync_batch_payload(
113 batch_id,
114 state="SYNC_COMPLETE",
115 all_syncs_succeeded=True,
116 syncs=[
117 dict(
118 id="SYNC0",
119 state="IMPORT_COMPLETE_NO_CHANGES",
120 item=dict(
121 id="MOCK_ITEM0",
122 institution_name="Chase",
123 ),

Callers

nothing calls this directly

Calls 1

_sync_batch_payloadFunction · 0.85

Tested by

no test coverage detected