Ai
1 Star 0 Fork 0

Adolph/shopify_python_api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
graphql_test.py 1019 Bytes
一键复制 编辑 原始数据 按行查看 历史
ShayneP 提交于 2019-06-07 12:17 +08:00 . Add docs + tests
import shopify
import json
from test.test_helper import TestCase
class GraphQLTest(TestCase):
def setUp(self):
super(GraphQLTest, self).setUp()
shopify.ApiVersion.define_known_versions()
shopify_session = shopify.Session('this-is-my-test-show.myshopify.com', 'unstable', 'token')
shopify.ShopifyResource.activate_session(shopify_session)
client = shopify.GraphQL()
self.fake(
'graphql',
method='POST',
code=201,
headers={
'X-Shopify-Access-Token': 'token',
'Accept': 'application/json',
'Content-Type': 'application/json'
})
query = '''
{
shop {
name
id
}
}
'''
self.result = client.execute(query)
def test_fetch_shop_with_graphql(self):
self.assertTrue(json.loads(self.result)['shop']['name'] == 'Apple Computers')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chen_guo_hong/shopify_python_api.git
git@gitee.com:chen_guo_hong/shopify_python_api.git
chen_guo_hong
shopify_python_api
shopify_python_api
master

搜索帮助