def test_get_snapshots_year_not_present(): jack = Character('jack', realm=Realm('kiljaeden', Region('us'))) jack.snapshots = {} now = datetime.datetime(2019, 8, 7) Utility.set_refresh_timestamp(now) _get_snapshots(jack) assert jack.world_quests_weekly == None assert jack.dungeons_weekly == None
def test_get_snapshots_snapshot_invalid_leave_as_none(): jack = Character('jack', realm=Realm('kiljaeden', Region('us'))) jack.snapshots = { 2019 : { 32 : Snapshot() } } # Values that should not be None are None. totals, snapshot values, etc. now = datetime.datetime(2019, 8, 7) Utility.set_refresh_timestamp(now) _get_snapshots(jack) assert jack.world_quests_weekly == None assert jack.dungeons_weekly == None
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