def test_morgue_file_from_s3(mocker): character = Character(name="beginbot") mocker.patch.object(character, "s3_morgue_file") expected_morgue_file = "Cool Morgue file" character.s3_morgue_file.return_value = expected_morgue_file morgue_file = character.morgue_file() character.s3_morgue_file.assert_called() assert morgue_file == expected_morgue_file
def test_morgue_file_from_crawl_server(mocker): character = Character(name="beginbot") mocker.patch.object(character, "s3_morgue_file") mocker.patch.object(character, "fetch_online_morgue") expected_morgue_file = "Online Morgue" character.s3_morgue_file.return_value = None character.fetch_online_morgue.return_value = expected_morgue_file morgue_file = character.morgue_file() character.s3_morgue_file.assert_called() character.fetch_online_morgue.assert_called() assert morgue_file == expected_morgue_file
def find_the_max_damage_for_all_characters(): characters = set(fetch_characters()) all_max_damages = [] for character_name in characters: print(f"\033[33mEntering {character_name} into the Weapon Awards...\033[0m") character = Character(name=character_name) weapons = fetch_weapons(character.morgue_file()) weapons_appraiser = WeaponsAppraiser(character=character, weapons=weapons) max_damages = weapons_appraiser.calc_max_damages() if max_damages == ["No Weapons Found!"]: print( f"\033[37mIt's ok get some weapons and come back: {character_name}\033[0m" ) else: all_max_damages.extend(max_damages) max_by_type = find_max_by_type(all_max_damages) celebrate_awards(max_by_type)