示例#1
0
def test_update_snapshot_do_not_add_on_missing_dungeons():
    clegg = Character('clegg', realm=Realm('kiljaeden', Region('us')))
    now = datetime.datetime(2019, 8, 5)
    Utility.set_refresh_timestamp(now)
    clegg.world_quests_total = 0

    update_snapshots(clegg)

    assert 2019 in clegg.snapshots
    assert 31 not in clegg.snapshots[2019]
示例#2
0
def test_update_snapshot_fill_missing_not_on_existing_week(mocker):
    mock_fill_missing_snapshots = mocker.patch('altaudit.processing._fill_missing_snapshots')
    clegg = Character('clegg', realm=Realm('kiljaeden', Region('us')))
    now = datetime.datetime(2019, 8, 5)
    clegg.snapshots[2019] = { 31 : Snapshot() }

    Utility.set_refresh_timestamp(now)

    update_snapshots(clegg)

    mock_fill_missing_snapshots.assert_not_called()
示例#3
0
def test_update_snapshot_fill_missing_on_new_week(mocker):
    mock_fill_missing_snapshots = mocker.patch('altaudit.processing._fill_missing_snapshots')
    clegg = Character('clegg', realm=Realm('kiljaeden', Region('us')))
    now = datetime.datetime(2019, 8, 5)
    clegg.snapshots[2019] = { 30 : Snapshot() }
    clegg.world_quests_total = 0
    clegg.dungeons_total = 0

    Utility.set_refresh_timestamp(now)

    update_snapshots(clegg)

    mock_fill_missing_snapshots.assert_called_once_with(clegg)
示例#4
0
def test_update_snapshot_capture_existing_totals():
    clegg = Character('clegg', realm=Realm('kiljaeden', Region('us')))
    now = datetime.datetime(2019, 8, 5)
    clegg.world_quests_total = 300
    clegg.dungeons_total = 40
    clegg.mplus_weekly_highest = 13
    clegg.snapshots[2019] = { 30 : Snapshot() }

    Utility.set_refresh_timestamp(now)

    update_snapshots(clegg)

    assert clegg.snapshots[2019][31].world_quests == 300
    assert clegg.snapshots[2019][31].dungeons == 40
    assert clegg.snapshots[2019][31].highest_mplus == None
    assert clegg.snapshots[2019][30].highest_mplus == 13
示例#5
0
def test_update_snapshot_no_overwrite_existing():
    clegg = Character('clegg', realm=Realm('kiljaeden', Region('us')))
    now = datetime.datetime(2019, 8, 5)
    clegg.snapshots[2019] = {}
    clegg.snapshots[2019][31] = Snapshot()
    clegg.snapshots[2019][31].world_quests = 5
    clegg.snapshots[2019][31].dungeons = 10
    clegg.snapshots[2019][31].highest_mplus = 13

    Utility.set_refresh_timestamp(now)

    update_snapshots(clegg)

    assert clegg.snapshots[2019][31].world_quests == 5
    assert clegg.snapshots[2019][31].dungeons == 10
    assert clegg.snapshots[2019][31].highest_mplus == 13