コード例 #1
0
def test_should_upload_ingest_fail3():
    # Same reg_period should not upload
    new_doc = {
        "reg_period": "201928",
        "used_hrs": "198",
        "_recno": "0",
        "_section": "D",
        "tab": "B"
    }
    last_inserted_doc = "201928"

    res = ubw_poller.should_upload_ingest(new_doc, last_inserted_doc)

    assert res is False
コード例 #2
0
def test_should_upload_ingest_success():
    # prev last_inserted_doc is smaller than new_doc, should upload.
    new_doc = {
        "reg_period": "201928",
        "used_hrs": "198",
        "_recno": "0",
        "_section": "D",
        "tab": "B"
    }
    last_inserted_doc = "201927"
    fake_datetime = datetime(2019, 8, 23, 22, 23, 29)
    res = ubw_poller.should_upload_ingest(new_doc, last_inserted_doc,
                                          fake_datetime)

    assert res
コード例 #3
0
def test_should_upload_ingest_fail6():
    # should not upload if the reg_period is too close to the current date.
    new_doc = {
        "reg_period": "201928",
        "used_hrs": "198",
        "_recno": "0",
        "_section": "D",
        "tab": "B"
    }
    last_inserted_doc = "201927"
    fake_datetime = datetime(2019, 7, 23, 22, 23, 29)
    res = ubw_poller.should_upload_ingest(new_doc, last_inserted_doc,
                                          fake_datetime)

    assert res is False