def test_process_removes_japanese_promotional_text_by_both_exact_match_and_regex(
            self, original_title, expected_title):
        original_data = requests_bodies.build_request_body(
            properties_to_be_updated={
                'title': original_title,
            },
            properties_to_be_removed=self.fields_to_append)
        optimizer = promo_text_removal_optimizer.PromoTextRemovalOptimizer()
        tracking_field = 'customLabel4'

        with mock.patch.dict('os.environ',
                             {'PRODUCT_TRACKING_FIELD': tracking_field}):
            optimized_data, optimization_result = optimizer.process(
                original_data, 'test')

            product = optimized_data['entries'][0]['product']
            self.assertEqual(expected_title, product['title'])
            self.assertEqual(1, optimization_result.num_of_products_optimized)
            self.assertEqual(enums.TrackingTag.SANITIZED.value,
                             product[tracking_field])
 def setUp(self):
     super(PromoTextRemovalOptimizerTest, self).setUp()
     app_util.setup_test_app()
     self.optimizer = promo_text_removal_optimizer.PromoTextRemovalOptimizer(
     )
     self.fields_to_append = ['gender', 'color', 'sizes', 'brand']