Ejemplo n.º 1
0
    def test_etsy_invalid_section(self):
        """ Test verifies, that invalid data from Etsy - null title in section - don't cause syncShop
            task to be failed.
            See HIVE-934 for more info.
        """

        expected_db_data = [
            ['1', 'syncShop', '2', 'done', ''],
        ]

        expected_db_data_sections = [['1', '2', '15183328', 'On Sale'],
                                     ['2', '2', '15180189', 'Holiday Gifts'],
                                     ['3', '2', '17365192', 'Summer Sale'],
                                     ['4', '2', '18790753', 'de'],
                                     ['5', '2', '18787742', 'bbbaa'],
                                     ['6', '2', '18790755', 'eeee']]

        self.stop_all()
        self.set_etsy_testcase('listings_invalid_section')
        run_sql('HIVE', 'listings_10', retry=2)
        setup_rabbit()
        self.restart_all()

        # check that sync task is done
        wait_for_assert(expected_db_data,
                        lambda: run_sql('HIVE', 'select_operations', True),
                        'syncShop task was not completed as expected')

        # check that sections are synced correctly - invalid section is ignored
        data = run_sql('HIVE', 'select_sections', True)
        assert data == expected_db_data_sections
Ejemplo n.º 2
0
    def test_etsy_listing_unavailable(self):
        """ Test verifies that shopSync task finishes correctly when a listing has status 'unavailable'.
            Such a listing does not contain all fields that listing should contain, i.e. title, price, quantity,
            therefore it is marked as invalid.
            See HIVE-1038 and HIVE-1046 for more info """

        expected_db_task_queue = [['1', 'syncShop', '2', 'done', ''],
                                  ['2', 'downloadProduct', '1', 'done', '']]

        expected_db_product_properties = [[
            '1', '2', 't', 'Unsupported listing state: unavailable'
        ]]

        self.stop_all()
        self.set_etsy_testcase('listings_status_unavailable')
        run_sql('HIVE', 'listings_10', retry=2)
        setup_rabbit()
        self.restart_all()

        # check that sync task is done
        wait_for_assert(expected_db_task_queue,
                        lambda: run_sql('HIVE', 'select_operations', True),
                        'syncShop task was not completed as expected')

        # check that product was marked as invalid and check the reason why
        data_db_product_properties = run_sql('HIVE',
                                             'select_product_properties', True)
        assert expected_db_product_properties == data_db_product_properties
Ejemplo n.º 3
0
    def test_etsy_null_character(self):
        """ Test verifies that listing is successfully imported when it has null character in description.
            Null character is ignored during import - see HIVE-1477
        """

        expected_descriptions = [
            'Description with null character',
            'Description without null character'
        ]

        self.set_etsy_testcase('listings_null_character')
        self.stop_all()
        run_sql('HIVE', 'listings_no_shop', retry=2)
        setup_rabbit()
        self.restart_all()

        # login and import shop
        lpg = LoginPage(self.driver)
        lpg.login(page=self.login_url_http)
        lpg.go_to_etsy()

        lpg.wait_during_sync_from_etsy()

        # check that two listings were imported
        db_data = run_sql('HIVE', 'select_description', True)
        assert len(
            db_data) == 2, 'Unexpected count of successfully imported listings'

        # check that descriptions were correctly imported for both listings
        descriptions = sorted([row[0] for row in db_data])
        assert descriptions == expected_descriptions, 'Unexpected descriptions of listings'
Ejemplo n.º 4
0
    def test_etsy_missing_title(self):
        """ Test verifies, that invalid data from Etsy - missing title - don't cause syncShop task to be suspended.
            See HIVE-845 for more info """

        expected_db_task_queue = [['1', 'syncShop', '2', 'done', ''],
                                  ['2', 'downloadProduct', '1', 'done', '']]

        expected_db_product_properties = [[
            '1', '2', 't', 'Title cannot be empty'
        ]]

        self.stop_all()
        self.set_etsy_testcase('listings_missing_title')
        run_sql('HIVE', 'listings_10', retry=2)
        setup_rabbit()
        self.restart_all()

        # check that sync task is done
        wait_for_assert(expected_db_task_queue,
                        lambda: run_sql('HIVE', 'select_operations', True),
                        'syncShop task was not completed as expected')

        # check that product was marked as invalid and check the reason why
        data_db_product_properties = run_sql('HIVE',
                                             'select_product_properties', True)
        assert expected_db_product_properties == data_db_product_properties
Ejemplo n.º 5
0
    def setup_method(self, method):
        super().setup_method(method)
        self.stop_all()
        run_sql('HIVE', 'listings_03', retry=2)
        run_sql('HIVE', 'update_shops_timestamp', retry=2)
        setup_rabbit()
        self.restart_all()

        lpg = LoginPage(self.driver)
        lpg.login(page=self.login_url_http)

        d = self.driver
        pg = MainPage(d)
        pg.get_main(self.base_url)
        pg.select_filter_tab('Active')
Ejemplo n.º 6
0
    def custom_setup(self, etsy_testcase):

        self.stop_all()
        self.set_etsy_testcase(etsy_testcase)
        run_sql('HIVE', 'listings_14', retry=2)
        run_sql('HIVE', 'update_shops_timestamp', retry=2)
        setup_rabbit()
        self.restart_all()

        lpg = LoginPage(self.driver)
        lpg.login(page=self.login_url_http)

        d = self.driver
        pg = MainPage(d)
        pg.get_main(self.base_url)
        pg.select_filter_tab('Active')
Ejemplo n.º 7
0
    def setup_method(self, method):
        super().setup_method(method)

        self.stop_all()
        setup_rabbit()
        self.set_etsy_testcase('listings_02')
        run_sql('HIVE', 'listings_02', retry=2)
        run_sql('HIVE', 'update_shops_timestamp', retry=2)
        self.restart_all()

        lp = LoginPage(self.driver)
        lp.login(page=self.login_url_http)

        mp = MainPage(self.driver)
        mp.get_main(self.base_url)
        mp.select_filter_tab('Active')
        mp.select_listings_to_edit(checked_listings=LISTINGS_TO_CHECK)

        bp = BulkPage(self.driver)
        click(bp.edit_part('Section'))
Ejemplo n.º 8
0
    def setup_method(self, method):
        super().setup_method(method)
        setup_rabbit()
        self.set_etsy_testcase('listings_16')
        self.stop_all()
        run_sql('HIVE', 'listings_16_changed', retry=2)
        run_sql('HIVE', 'update_shops_timestamp', retry=2)
        self.restart_all()

        self.db = HiveDatabase(HIVE_DATABASE_URL)

        lp = LoginPage(self.driver)
        lp.login(page=self.login_url_http)

        # Select both listings and go to bulk editor
        mp = MainPage(self.driver)
        mp.get_main(self.base_url)
        mp.select_filter_tab('Active')

        mp.select_listings_to_edit(checked_listings='ALL')
Ejemplo n.º 9
0
def rabbit_init(request):
    """ Setup rabbit queues for a test - in some cases it is necessary to prepare the rabbit setup from scratch
        We should ideally do it for each test to start from a clean slate.
    """
    setup_rabbit()