def test_versions():
    NORMALIZED['source'] = RAW['source']
    NORMALIZED['_id'] = RAW['docID']
    test_db.process_normalized(RAW, NORMALIZED, index='test')

    old_title = NORMALIZED['title']
    result = es.search(index='test', doc_type=RAW['source'])['hits']['hits'][0]

    assert (result['_source']['title'] == old_title)

    NORMALIZED['title'] = 'a new title'
    test_db.process_normalized(RAW, NORMALIZED, index='test')
    results = es.search(index='test', doc_type=RAW['source'])
    assert (len(results['hits']['hits']) == 1)
    assert (results['hits']['hits'][0]['_source']['title'] == 'a new title')
def test_versions():
    NORMALIZED["source"] = RAW["source"]
    NORMALIZED["_id"] = RAW["docID"]
    test_db.process_normalized(RAW, NORMALIZED, index="test")

    old_title = NORMALIZED["title"]
    result = es.search(index="test", doc_type=RAW["source"])["hits"]["hits"][0]

    assert result["_source"]["title"] == old_title

    NORMALIZED["title"] = "a new title"
    test_db.process_normalized(RAW, NORMALIZED, index="test")
    results = es.search(index="test", doc_type=RAW["source"])
    assert len(results["hits"]["hits"]) == 1
    assert results["hits"]["hits"][0]["_source"]["title"] == "a new title"
def test_process_normalized():
    test_db.process_normalized(RAW, NORMALIZED, index='test')

    results = es.search(index='test', doc_type=RAW['source'])
    assert (len(results['hits']['hits']) == 1)
def test_process_normalized():
    test_db.process_normalized(RAW, NORMALIZED, index="test")

    results = es.search(index="test", doc_type=RAW["source"])
    assert len(results["hits"]["hits"]) == 1