示例#1
0
    def test_company_map(self):
        # this tests #34
        insert_rows(
            self.scratch_db,
            "category",
            [dict(brand="", category="Footwear", company="Indosole, LLC", scraper_id="sr.campaign.b_corp")],
        )

        insert_rows(
            self.output_db,
            "scraper_category_map",
            [dict(category="Footwear", scraper_category="Footwear", scraper_id="sr.campaign.b_corp")],
        )

        insert_rows(
            self.output_db,
            "scraper_company_map",
            [dict(company="Indosole", scraper_company="Indosole, LLC", scraper_id="sr.campaign.b_corp")],
        )

        build_category_table(self.output_db, self.scratch_db)

        self.assertEqual(
            select_all(self.output_db, "category"),
            [dict(brand="", category="Footwear", company="Indosole", is_implied=0)],
        )
示例#2
0
    def test_empty(self):
        build_category_table(self.output_db, self.scratch_db)

        self.assertEqual(select_all(self.output_db, "category"), [])