Пример #1
0
def initialize_shopify_client():
    api_key = Context.config['api_key']
    shop = Context.config['shop']
    version = '2022-01'
    session = shopify.Session(shop, version, api_key)
    shopify.ShopifyResource.activate_session(session)

    # set request timeout
    shopify.Shop.set_timeout(get_request_timeout())

    # Shop.current() makes a call for shop details with provided shop and api_key
    return shopify.Shop.current().attributes
Пример #2
0
    def test_timeout_value_not_passed_in_config(self):
        """
            Test case to verify that the default value is used when we do not pass request timeout value from config
        """
        # initialize config
        Context.config = {
            "start_date": "2021-01-01",
            "api_key": "test_api_key",
            "shop": "test_shop",
            "results_per_page": 50
        }

        # initialize base class
        timeout = get_request_timeout()
        # verify the timeout is set as expected
        self.assertEquals(timeout, 300)
Пример #3
0
    def test_timeout_string_value_passed_in_config(self):
        """
            Test case to verify that the value we passed on config is set as request timeout value
        """
        # initialize config
        Context.config = {
            "start_date": "2021-01-01",
            "api_key": "test_api_key",
            "shop": "test_shop",
            "results_per_page": 50,
            "request_timeout": "100"
        }

        # initialize base class
        timeout = get_request_timeout()
        # verify the timeout is set as expected
        self.assertEquals(timeout, 100)