本文整理汇总了Python中appurify.client.AppurifyClient类的典型用法代码示例。如果您正苦于以下问题:Python AppurifyClient类的具体用法?Python AppurifyClient怎么用?Python AppurifyClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AppurifyClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testPollTimeoutCode
def testPollTimeoutCode(self):
mockRequestGet.count = -20
client = AppurifyClient(api_key="test_key", api_secret="test_secret", test_type="ios_webrobot",
app_src=None,
test_src=None,
url="www.yahoo.com",
timeout_sec=0.2,
poll_every=0.1)
result_code = client.main()
self.assertEqual(result_code, 3, "Main should execute and return error code")
示例2: testDefaultPollTimeoutCode
def testDefaultPollTimeoutCode(self):
old_env = os.environ.get('APPURIFY_API_TIMEOUT', None)
try:
os.environ['APPURIFY_API_TIMEOUT'] = '0.2'
mockRequestGet.count = -20
client = AppurifyClient(access_token="authenticated", poll_every=0.1)
result_code = client.main()
self.assertEqual(result_code, 1, "Main should execute and return error code with default timeout")
finally:
if old_env:
os.environ['APPURIFY_API_TIMEOUT'] = str(old_env)
示例3: testDefaultPollTimeout
def testDefaultPollTimeout(self):
old_env = os.environ.get('APPURIFY_API_TIMEOUT', None)
try:
os.environ['APPURIFY_API_TIMEOUT'] = '0.2'
mockRequestGet.count = -20
client = AppurifyClient(access_token="authenticated", poll_every=0.1)
with self.assertRaises(AppurifyClientError):
client.pollTestResult("test_test_run_id", 0.2)
finally:
if old_env:
os.environ['APPURIFY_API_TIMEOUT'] = str(old_env)
示例4: testMainPass
def testMainPass(self):
mockRequestGet.count = 0
mockRequestGet.passes = 2
mockRequestGet.fails = 0
mockRequestGet.pass_val = True
client = AppurifyClient(api_key="test_key", api_secret="test_secret", test_type="uiautomation",
app_src=__file__, app_src_type='raw',
test_src=__file__, test_src_type='raw',
timeout_sec=2, poll_every=0.1)
result_code = client.main()
self.assertEqual(result_code, 0, "Main should execute and return pass code")
示例5: main
def main():
""" main program
"""
for i in xrange(1,len(sys.argv)):
print "File: %s"%sys.argv[i]
params = {}
if (len(sys.argv)>0):
params = parse_input(sys.argv[1])
# print params
client = AppurifyClient(**params)
sys.exit(client.main())
示例6: testMainPassUrl
def testMainPassUrl(self):
mockRequestGet.count = 0
mockRequestGet.passes = 2
mockRequestGet.fails = 0
mockRequestGet.pass_val = True
client = AppurifyClient(api_key="test_key", api_secret="test_secret", test_type="ios_webrobot",
app_src=None,
test_src=None,
url="www.yahoo.com",
timeout_sec=2, poll_every=0.1)
result_code = client.main()
self.assertEqual(result_code, 0, "Main should execute and return pass code")
示例7: testMainFail
def testMainFail(self):
mockRequestGet.count = 0
mockRequestGet.passes = 1
mockRequestGet.fails = 1
mockRequestGet.exception = 0
mockRequestGet.pass_val = False
client = AppurifyClient(api_key="test_key", api_secret="test_secret", test_type="uiautomation",
app_src=__file__, app_src_type='raw',
test_src=__file__, test_src_type='raw',
timeout_sec=2, poll_every=0.1, device_type_id="137")
result_code = client.main()
self.assertEqual(result_code, 1, "Main should execute and return fail code")
示例8: testDefaultPollTimeoutCode
def testDefaultPollTimeoutCode(self):
old_env = os.environ.get('APPURIFY_API_TIMEOUT', None)
try:
os.environ['APPURIFY_API_TIMEOUT'] = '0.2'
mockRequestGet.count = -20
client = AppurifyClient(api_key="test_key", api_secret="test_secret", test_type="ios_webrobot",
app_src=None,
test_src=None,
url="www.yahoo.com",
poll_every=0.1)
result_code = client.main()
self.assertEqual(result_code, 3, "Main should execute and return error code with default timeout")
finally:
if old_env:
os.environ['APPURIFY_API_TIMEOUT'] = str(old_env)
示例9: testPrintConfig
def testPrintConfig(self):
client = AppurifyClient(access_token="authenticated", test_type="ios_webrobot")
config = [{
"id": 1963,
"device": {
"id": 123,
"profiler": True,
"videocapture": True,
},
"framework": "{\"uiautomation\": {\"template\": \"Memory_Profiling_Template\"}}",
"test_timeout": 240,
"debug": False,
"keep_vm": False,
"device_types": [],
"vm_size": "small"
}]
client.printConfigs(config)
示例10: testUploadAppSource
def testUploadAppSource(self):
client = AppurifyClient(access_token="authenticated", app_src=__file__, app_src_type='raw', test_type='calabash', name="test_name")
app_id = client.uploadApp()
self.assertEqual(app_id, "test_app_id", "Should properly fetch web robot for app id")
示例11: testPollTestResult
def testPollTestResult(self):
mockRequestGet.count = 0
client = AppurifyClient(access_token="authenticated", timeout_sec=2, poll_every=0.1)
test_status_response = client.pollTestResult("test_test_run_id", 2)
self.assertEqual(test_status_response['status'], "complete", "Should poll until complete")
示例12: testRunTestMulti
def testRunTestMulti(self):
client = AppurifyClient(access_token="authenticated")
test_run_id, queue_timeout_limit, configs = client.runTest("app_id", "test_test_id")
self.assertEqual(test_run_id, "test_test_run_id1,test_test_run_id2", "Should get test_run_ids when executing run")
self.assertEqual(len(configs), 2, "Should get config back for test run")
self.assertEqual(configs[0]['device']['id'], 123, "Sanity check parameters")
示例13: testUploadConfig
def testUploadConfig(self):
client = AppurifyClient(access_token="authenticated", test_type="ios_webrobot")
config_id = client.uploadConfig("test_id", config_src=__file__)
self.assertEqual(config_id, 23456, "Should properly fetch uploaded config id")
示例14: testUploadTestNoSourceError
def testUploadTestNoSourceError(self):
client = AppurifyClient(access_token="authenticated", test_type='uiautomation')
with self.assertRaises(AppurifyClientError):
app_id = client.uploadTest('test_app_id')
示例15: testPollTimeoutCode
def testPollTimeoutCode(self):
mockRequestGet.count = -20
client = AppurifyClient(access_token="authenticated", timeout_sec=0.2, poll_every=0.1)
result_code = client.main()
self.assertEqual(result_code, 1, "Main should execute and return error code")