def test_oauth_access_token(self):
        encoding = 'UTF-8'
        credentials = Credentials()
        shopify = Shopify(shop_name='test', credentials=credentials)

        data = '{"access_token": "test"}'
        response = requests.Response()
        response.encoding = encoding
        response._content = data.encode(encoding)
        response.status_code = 200
        shopify.session.post = mock.Mock(return_value=response)

        access_token = shopify.oauth_access_token()
        self.assertEquals(access_token, "test")

        response.status_code = 403
        shopify.session.post = mock.Mock(return_value=response)
        try:
            access_token = shopify.oauth_access_token()
            self.fail()
        except ShopifyException:
            pass
    def test_oauth_access_token(self):
        encoding = 'UTF-8'
        credentials = Credentials()
        shopify = Shopify(shop_name='test', credentials=credentials)

        data = '{"access_token": "test"}'
        response = requests.Response()
        response.encoding = encoding
        response._content = data.encode(encoding)
        response.status_code = 200
        shopify.session.post = mock.Mock(return_value=response)

        access_token = shopify.oauth_access_token()
        self.assertEquals(access_token, "test")

        response.status_code = 403
        shopify.session.post = mock.Mock(return_value=response)
        try:
            access_token = shopify.oauth_access_token()
            self.fail()
        except ShopifyException:
            pass