(knowledge_webapp, aiohttp_client, fire_event_mock)
| 186 | |
| 187 | |
| 188 | async def test_remove_relationship(knowledge_webapp, aiohttp_client, fire_event_mock): |
| 189 | client = await aiohttp_client(knowledge_webapp) |
| 190 | op_id_test = 'this_is_a_valid_operation_id' |
| 191 | fact_data_a = { |
| 192 | 'trait': 'a', |
| 193 | 'value': '1', |
| 194 | } |
| 195 | fact_data_b = { |
| 196 | 'trait': 'b', |
| 197 | 'value': '2' |
| 198 | } |
| 199 | relationship_data = { |
| 200 | 'source': fact_data_a, |
| 201 | 'edge': 'alpha', |
| 202 | 'target': fact_data_b, |
| 203 | 'origin': op_id_test |
| 204 | } |
| 205 | init = await client.post('/relationships', json=relationship_data, headers=headers) |
| 206 | pre = await init.json() |
| 207 | subs = await client.delete('/relationships', json=dict(edge='alpha'), headers=headers) |
| 208 | post = await subs.json() |
| 209 | resp = await client.get('/relationships', json=relationship_data, headers=headers) |
| 210 | cur = await resp.json() |
| 211 | start = pre['added'] |
| 212 | end = post['removed'] |
| 213 | current = cur['found'] |
| 214 | assert len(start) == 1 |
| 215 | assert len(end) == 1 |
| 216 | assert len(current) == 0 |
| 217 | assert start == end |
| 218 | |
| 219 | |
| 220 | async def test_add_fact(knowledge_webapp, aiohttp_client, fire_event_mock): |
nothing calls this directly
no test coverage detected