Beispiel #1
0
def test_create_document_no_client():
    event = Event(event_id='1')
    document = event.create_document(
        'plaintext', "“You're no help,” he told the lime. "
        "This was unfair. It was only a lime; "
        "there was nothing special about it at all. "
        "It was doing the best it could.")
    assert event.documents['plaintext'] == document
Beispiel #2
0
def test_create_document(mocker):
    client = mocker.Mock(EventsClient)
    client.get_local_instance.return_value = client
    event = Event(event_id='1', client=client)
    document = event.create_document(
        'plaintext', "“You're no help,” he told the lime. "
        "This was unfair. It was only a lime; "
        "there was nothing special about it at all. "
        "It was doing the best it could.")
    assert event.documents['plaintext'] == document
    client.add_document.assert_called_once_with(
        '1', 'plaintext', "“You're no help,” he told the lime. "
        "This was unfair. It was only a lime; "
        "there was nothing special about it at all. "
        "It was doing the best it could.")