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]
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()
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_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
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