def test_blending_ori_weight_of_the_underworld(self):
        file_path = os.path.join(BLENDING_DIR,
                                 "ori_weight_of_the_underworld.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Weight of the Underworld", card["name"])
    def test_magiccardinfo_ori_thornbow_archer(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR,
                                 "ori_thornbow_archer.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Thornbow Archer", card["name"])
    def test_gatherer_frf_ugin_the_spirit_dragon(self):
        file_path = os.path.join(GATHERER_DIR,
                                 "frf_ugin_the_spirit_dragon.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Ugin, the Spirit Dragon", card["name"])
    def test_magiccardinfo_dtk_vial_of_dragonfire(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR,
                                 "dtk_vial_of_dragonfire.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Vial of Dragonfire", card["name"])
    def test_magiccardinfo_frf_reach_of_shadow(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR,
                                 "frf_reach_of_shadow.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Reach of Shadows", card["name"])
    def test_magiccardinfo_frf_ugin_the_spirit_dragon(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR,
                                 "frf_ugin_the_spirit_dragon.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Ugin, the Spirit Dragon", card["name"])
    def test_magiccardinfo_frf_torrent_elemental(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR,
                                 "frf_torrent_elemental.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Torrent Elemental", card["name"])
    def post(self, request):
        context = {
            "result": None,
        }
        form = UploadImageForm(request.POST, request.FILES)
        context["form"] = form

        if form.is_valid():
            card = identify_file(request.FILES['image'].file.name, True)
            context["result"] = json.dumps(card, indent=4, sort_keys=True)
            context["card"] = card

        return render(request, "mtg_card_identifier_web/index.html", context)
    def post(self, request):
        context = {
            "result": None,
        }
        form = UploadImageForm(request.POST, request.FILES)
        context["form"] = form

        if form.is_valid():
            card = identify_file(request.FILES['image'].file.name, True)
            context["result"] = json.dumps(card, indent=4, sort_keys=True)
            context["card"] = card

        return render(request, "mtg_card_identifier_web/index.html", context)
    def test_blending_frf_will_of_the_naga(self):
        file_path = os.path.join(BLENDING_DIR, "frf_will_of_the_naga.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Will of the Naga", card["name"])
    def test_blending_frf_tasigurs_cruelty(self):
        file_path = os.path.join(BLENDING_DIR, "frf_tasigurs_cruelty.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Tasigur's Cruelty", card["name"])
    def test_gatherer_frf_reach_of_shadow(self):
        file_path = os.path.join(GATHERER_DIR, "frf_reach_of_shadow.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Reach of Shadows", card["name"])
    def test_blending_frf_cunning_strike(self):
        file_path = os.path.join(BLENDING_DIR, "frf_cunning_strike.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Cunning Strike", card["name"])
    def test_busy_dtk_gurmag_drowner_three(self):
        file_path = os.path.join(BUSY_DIR, "dtk_gurmag_drowner_3.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Gurmag Drowner", card["name"])
    def test_aven_battle_priest_three(self):
        file_path = os.path.join(DAMAGED_DIR, "ori_aven_battle_priest_3.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Aven Battle Priest", card["name"])
    def test_blending_frf_lightform(self):
        file_path = os.path.join(BLENDING_DIR, "frf_lightform.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Lightform", card["name"])
    def test_orientation_disperse_five(self):
        file_path = os.path.join(ORIENTATION_DIR, "ori_disperse_5.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Disperse", card["name"])
    def test_gatherer_frf_torrent_elemental(self):
        file_path = os.path.join(GATHERER_DIR, "frf_torrent_elemental.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Torrent Elemental", card["name"])
    def test_blending_ori_weight_of_the_underworld(self):
        file_path = os.path.join(BLENDING_DIR, "ori_weight_of_the_underworld.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Weight of the Underworld", card["name"])
    def test_blending_ori_tower_geist(self):
        file_path = os.path.join(BLENDING_DIR, "ori_tower_geist.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Tower Geist", card["name"])
    def test_blending_ori_swamp(self):
        file_path = os.path.join(BLENDING_DIR, "ori_swamp.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Swamp", card["name"])
    def test_blending_ori_might_of_the_masses(self):
        file_path = os.path.join(BLENDING_DIR, "ori_might_of_the_masses.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Might of the Masses", card["name"])
    def test_blending_ori_mage_ring_bully(self):
        file_path = os.path.join(BLENDING_DIR, "ori_mage_ring_bully.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Mage-Ring Bully", card["name"])
    def test_blending_ori_mage_ring_bully(self):
        file_path = os.path.join(BLENDING_DIR, "ori_mage_ring_bully.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Mage-Ring Bully", card["name"])
    def test_blending_ori_swamp(self):
        file_path = os.path.join(BLENDING_DIR, "ori_swamp.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Swamp", card["name"])
    def test_perspective_valor_in_akros_two(self):
        file_path = os.path.join(PERSPECTIVE_DIR, "ori_valor_in_akros_2.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Valor in Akros", card["name"])
    def test_orientation_disperse_five(self):
        file_path = os.path.join(ORIENTATION_DIR, "ori_disperse_5.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Disperse", card["name"])
    def test_aven_battle_priest_three(self):
        file_path = os.path.join(DAMAGED_DIR, "ori_aven_battle_priest_3.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Aven Battle Priest", card["name"])
    def test_busy_scour_from_existence_three(self):
        file_path = os.path.join(BUSY_DIR, "bfz_scour_from_existence_3.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Scour from Existence", card["name"])
    def test_gatherer_frf_ugin_the_spirit_dragon(self):
        file_path = os.path.join(GATHERER_DIR, "frf_ugin_the_spirit_dragon.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Ugin, the Spirit Dragon", card["name"])
    def test_gatherer_m15_swamp(self):
        file_path = os.path.join(GATHERER_DIR, "m15_swamp.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Swamp", card["name"])
    def test_busy_scour_from_existence_three(self):
        file_path = os.path.join(BUSY_DIR, "bfz_scour_from_existence_3.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Scour from Existence", card["name"])
    def test_blending_dtk_roast(self):
        file_path = os.path.join(BLENDING_DIR, "dtk_roast.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Roast", card["name"])
    def test_busy_bfz_stone_haven_medic_four(self):
        file_path = os.path.join(BUSY_DIR, "bfz_stone_haven_medic_4.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Stone Haven Medic", card["name"])
    def test_blending_frf_lightform(self):
        file_path = os.path.join(BLENDING_DIR, "frf_lightform.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Lightform", card["name"])
    def test_busy_dtk_gurmag_drowner_three(self):
        file_path = os.path.join(BUSY_DIR, "dtk_gurmag_drowner_3.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Gurmag Drowner", card["name"])
    def test_gatherer_frf_reach_of_shadow(self):
        file_path = os.path.join(GATHERER_DIR, "frf_reach_of_shadow.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Reach of Shadows", card["name"])
    def test_gatherer_ktk_mountain(self):
        file_path = os.path.join(GATHERER_DIR, "ktk_mountain.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Mountain", card["name"])
    def test_blending_ori_blood_cursed_knight(self):
        file_path = os.path.join(BLENDING_DIR, "ori_blood_cursed_knight.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Blood-Cursed Knight", card["name"])
    def test_gatherer_m15_swamp(self):
        file_path = os.path.join(GATHERER_DIR, "m15_swamp.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Swamp", card["name"])
    def test_blending_ori_might_of_the_masses(self):
        file_path = os.path.join(BLENDING_DIR, "ori_might_of_the_masses.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Might of the Masses", card["name"])
    def test_gatherer_ori_thornbow_archer(self):
        file_path = os.path.join(GATHERER_DIR, "ori_thornbow_archer.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Thornbow Archer", card["name"])
    def test_blending_ori_tower_geist(self):
        file_path = os.path.join(BLENDING_DIR, "ori_tower_geist.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Tower Geist", card["name"])
    def test_magiccardinfo_dtk_vial_of_dragonfire(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR, "dtk_vial_of_dragonfire.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Vial of Dragonfire", card["name"])
    def test_gatherer_frf_torrent_elemental(self):
        file_path = os.path.join(GATHERER_DIR, "frf_torrent_elemental.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Torrent Elemental", card["name"])
    def test_magiccardinfo_frf_cunning_strike(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR, "frf_cunning_strike.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Cunning Strike", card["name"])
    def test_perspective_valor_in_akros_two(self):
        file_path = os.path.join(PERSPECTIVE_DIR, "ori_valor_in_akros_2.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Valor in Akros", card["name"])
    def test_magiccardinfo_frf_reach_of_shadow(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR, "frf_reach_of_shadow.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Reach of Shadows", card["name"])
    def test_blending_frf_formless_nurturing(self):
        file_path = os.path.join(BLENDING_DIR, "frf_formless_nurturing.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Formless Nurturing", card["name"])
    def test_magiccardinfo_frf_torrent_elemental(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR, "frf_torrent_elemental.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Torrent Elemental", card["name"])
    def test_busy_bfz_stone_haven_medic_four(self):
        file_path = os.path.join(BUSY_DIR, "bfz_stone_haven_medic_4.JPG")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Stone Haven Medic", card["name"])
    def test_blending_dtk_lightning_berseker(self):
        file_path = os.path.join(BLENDING_DIR, "dtk_lightning_berserker.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Lightning Berserker", card["name"])
    def test_gatherer_ktk_mountain(self):
        file_path = os.path.join(GATHERER_DIR, "ktk_mountain.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Mountain", card["name"])
    def test_blending_frf_will_of_the_naga(self):
        file_path = os.path.join(BLENDING_DIR, "frf_will_of_the_naga.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Will of the Naga", card["name"])
    def test_gatherer_ori_thornbow_archer(self):
        file_path = os.path.join(GATHERER_DIR, "ori_thornbow_archer.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Thornbow Archer", card["name"])
    def test_blending_frf_tasigurs_cruelty(self):
        file_path = os.path.join(BLENDING_DIR, "frf_tasigurs_cruelty.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Tasigur's Cruelty", card["name"])
    def test_magiccardinfo_frf_cunning_strike(self):
        file_path = os.path.join(MAGIC_CARD_INFO_DIR, "frf_cunning_strike.jpg")
        card = identify_file(file_path)

        self.assertIsNotNone(card)
        self.assertEqual("Cunning Strike", card["name"])
    def test_blending_frf_cunning_strike(self):
        file_path = os.path.join(BLENDING_DIR, "frf_cunning_strike.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Cunning Strike", card["name"])
    def test_blending_frf_formless_nurturing(self):
        file_path = os.path.join(BLENDING_DIR, "frf_formless_nurturing.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Formless Nurturing", card["name"])
    def test_blending_ori_blood_cursed_knight(self):
        file_path = os.path.join(BLENDING_DIR, "ori_blood_cursed_knight.jpg")
        card = identify_file(file_path, find_card=True)

        self.assertIsNotNone(card)
        self.assertEqual("Blood-Cursed Knight", card["name"])