Example #1
0
def test_contact_auto_updates_to_opensearch(opensearch_with_signals):
    """Tests if contact gets updated in OpenSearch."""
    test_name = 'very_hard_to_find_contact_ii'
    contact = ContactFactory(first_name=test_name, )
    contact.save()

    new_test_name = 'very_hard_to_find_contact_v'
    contact.first_name = new_test_name
    contact.save()
    opensearch_with_signals.indices.refresh()

    result = get_basic_search_query(Contact, new_test_name).execute()

    assert result.hits.total.value == 1
    assert result.hits[0].id == str(contact.id)
Example #2
0
def test_contact_auto_updates_to_es(setup_es):
    """Tests if contact gets updated in Elasticsearch."""
    test_name = 'very_hard_to_find_contact_ii'
    contact = ContactFactory(first_name=test_name, )
    contact.save()

    new_test_name = 'very_hard_to_find_contact_v'
    contact.first_name = new_test_name
    contact.save()
    setup_es.indices.refresh()

    result = get_basic_search_query(new_test_name,
                                    entities=(Contact, )).execute()

    assert result.hits.total == 1
    assert result.hits[0].id == str(contact.id)