def test_update_snapshot_do_not_add_on_missing_world_quests(): clegg = Character('clegg', realm=Realm('kiljaeden', Region('us'))) now = datetime.datetime(2019, 8, 5) Utility.set_refresh_timestamp(now) clegg.dungeons_total = 0 update_snapshots(clegg) assert 2019 in clegg.snapshots assert 31 not in clegg.snapshots[2019]
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)
def test_get_snapshots_negative_dungeons(): jack = Character('jack', realm=Realm('kiljaeden', Region('us'))) jack.snapshots = { 2019 : { 32 : Snapshot() } } jack.snapshots[2019][32].world_quests = 300 jack.snapshots[2019][32].dungeons = 20 jack.world_quests_total = 320 jack.dungeons_total = 18 now = datetime.datetime(2019, 8, 7) Utility.set_refresh_timestamp(now) _get_snapshots(jack) assert jack.dungeons_weekly == 0 assert jack.snapshots[2019][32].dungeons == 18
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