def test_delete_permanently_with_invalid_id_should_fail( cosmos_db_repository: CosmosDBRepository, event_context: EventContext, tenant_id: str, ): try: cosmos_db_repository.delete_permanently(fake.uuid4(), event_context) fail('It should have not found the deleted item') except Exception as e: assert type(e) is CosmosResourceNotFoundError assert e.status_code == 404
def test_delete_permanently_with_valid_id_should_succeed( cosmos_db_repository: CosmosDBRepository, event_context: EventContext, sample_item: dict, ): found_item = cosmos_db_repository.find(sample_item['id'], event_context) assert found_item is not None assert found_item['id'] == sample_item['id'] cosmos_db_repository.delete_permanently(sample_item['id'], event_context) try: cosmos_db_repository.find(sample_item['id'], event_context) fail('It should have not found the deleted item') except Exception as e: assert type(e) is CosmosResourceNotFoundError assert e.status_code == 404