本文整理汇总了Python中testlink.TestLinkHelper.uploadAttachment方法的典型用法代码示例。如果您正苦于以下问题:Python TestLinkHelper.uploadAttachment方法的具体用法?Python TestLinkHelper.uploadAttachment怎么用?Python TestLinkHelper.uploadAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testlink.TestLinkHelper
的用法示例。
在下文中一共展示了TestLinkHelper.uploadAttachment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestLinkAPIGenericOnlineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import uploadAttachment [as 别名]
#.........这里部分代码省略.........
with self.assertRaisesRegex(TLResponseError, '5040.*N-40000711'):
self.client.deleteTestCaseSteps('N-40000711', steps, version=1)
def test_uploadRequirementSpecificationAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
with self.assertRaisesRegex(TLResponseError, '6004.*40000712'):
self.client.uploadRequirementSpecificationAttachment(attachemantFile, 40000712,
title='title 40000713', description='descr. 40000714')
def test_uploadRequirementAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
with self.assertRaisesRegex(TLResponseError, '6004.*40000712'):
self.client.uploadRequirementAttachment(attachemantFile, 40000712,
title='title 40000713', description='descr. 40000714')
def test_uploadTestProjectAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
with self.assertRaisesRegex(TLResponseError, '7000.*40000712'):
self.client.uploadTestProjectAttachment(attachemantFile, 40000712,
title='title 40000713', description='descr. 40000714')
def test_uploadTestSuiteAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
with self.assertRaisesRegex(TLResponseError, '8000.*40000712'):
self.client.uploadTestSuiteAttachment(attachemantFile, 40000712,
title='title 40000713', description='descr. 40000714')
def test_uploadTestCaseAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
with self.assertRaisesRegex(TLResponseError, '5000.*testcaseid'):
self.client.uploadTestCaseAttachment(attachemantFile, 40000712,
title='title 40000713', description='descr. 40000714')
def test_uploadAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, 'r')
with self.assertRaisesRegex(TLResponseError, '6004.*Invalid Foreign Key ID'):
self.client.uploadAttachment(attachemantFile, '0000', 'nodes_hierarchy',
title='title 40000713', description='descr. 40000714')
def test_testLinkVersion(self):
response = self.client.testLinkVersion()
self.assertRegex(response, '\d*\.\d*\.\d*')
def test_getUserByLogin_unknownKey(self):
with self.assertRaisesRegex(TLResponseError, '10000.*User Login'):
self.client.getUserByLogin('unknownUser')
def test_getUserByID_unknownKey(self):
with self.assertRaisesRegex(TLResponseError, 'NO_USER_BY_ID_LOGIN.*User with DB ID'):
self.client.getUserByID(40000711)
# def test_setTestMode(self):
# response = self.client.setTestMode(True)
# self.assertTrue(response)
# response = self.client.setTestMode(False)
# self.assertTrue(response)
def test_deleteExecution_unknownKey(self):
try:
response = self.client.deleteExecution(40000711)
# case: TL configuration allows deletion of executions
# response returns Success, even if executionID is unkown
self.assertEqual([{'status': True, 'message': 'Success!', 'id': 40000711,
'operation': 'deleteExecution'}], response)
except TLResponseError as tl_err:
# case: TL configuration does not allow deletion of executions
示例2: TestLinkAPIOnlineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import uploadAttachment [as 别名]
#.........这里部分代码省略.........
testcaseexternalid='N-4711', version=1)
def test_deleteTestCaseSteps_unknownID(self):
steps = [2,8]
with self.assertRaisesRegexp(TLResponseError, '5040.*N-4711'):
self.client.deleteTestCaseSteps('N-4711', steps, version=1)
def test_uploadRequirementSpecificationAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '6004.*4712'):
self.client.uploadRequirementSpecificationAttachment(attachemantFile, 4712,
title='title 4713', description='descr. 4714')
def test_uploadRequirementAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '6004.*4712'):
self.client.uploadRequirementAttachment(attachemantFile, 4712,
title='title 4713', description='descr. 4714')
def test_uploadTestProjectAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '7000.*4712'):
self.client.uploadTestProjectAttachment(attachemantFile, 4712,
title='title 4713', description='descr. 4714')
def test_uploadTestSuiteAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '8000.*4712'):
self.client.uploadTestSuiteAttachment(attachemantFile, 4712,
title='title 4713', description='descr. 4714')
def test_uploadTestCaseAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '5000.*testcaseid'):
self.client.uploadTestCaseAttachment(attachemantFile, 4712,
title='title 4713', description='descr. 4714')
def test_uploadAttachment_unknownID(self):
attachemantFile = open(os.path.realpath(__file__), 'r')
with self.assertRaisesRegexp(TLResponseError, '6004.*4712'):
self.client.uploadAttachment(attachemantFile, 4712, 'nodes_hierarchy',
title='title 4713', description='descr. 4714')
def test_testLinkVersion(self):
response = self.client.testLinkVersion()
self.assertRegexpMatches(response, '\d*\.\d*\.\d*')
def test_getUserByLogin_unknownKey(self):
with self.assertRaisesRegexp(TLResponseError, '10000.*User Login'):
self.client.getUserByLogin(user='unknownUser')
# def test_setTestMode(self):
# response = self.client.setTestMode(True)
# self.assertTrue(response)
# response = self.client.setTestMode(False)
# self.assertTrue(response)
def test_deleteExecution_unknownKey(self):
try:
response = self.client.deleteExecution(4711)
# case: TL configuration allows deletion of executions
# response returns Success, even if executionID is unkown
self.assertEqual([{'status': True, 'message': 'Success!', 'id': 4711,
'operation': 'deleteExecution'}], response)
except TLResponseError as tl_err:
# case: TL configuration does not allow deletion of executions
# Expects: 232: Configuration does not allow delete executions
self.assertEqual(232, tl_err.code)
def test_setTestCaseExecutionType_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4712'):
self.client.setTestCaseExecutionType('N-4711', 1, 4712, 1)
def test_assignRequirements_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '7000.*4712'):
self.client.assignRequirements('N-4711', 4712,
[{'req_spec' : 4713, 'requirements' : [4714, 4717]},
{'req_spec' : 4723, 'requirements' : [4725]}])
def test_getExecCountersByBuild_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.getExecCountersByBuild(4711)
def test_assignTestCaseExecutionTask_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.assignTestCaseExecutionTask('username', 4711, 'TC-4712',
buildname='build 4713',
platformname='platform 4714')
def test_getTestCaseBugs_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.getTestCaseBugs(4711, testcaseexternalid='TC-4712',
buildname='build 4713',
platformname='platform 4714')
def test_getTestCaseAssignedTester_unknownID(self):
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
self.client.getTestCaseAssignedTester(4711, 'TC-4712',
buildname='build 4713',
platformname='platform 4714')
示例3: TestLinkAPIOnlineTestCase
# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import uploadAttachment [as 别名]
#.........这里部分代码省略.........
with self.assertRaisesRegex(TLResponseError, "6004.*40000712"):
self.client.uploadRequirementSpecificationAttachment(
attachemantFile, 40000712, title="title 40000713", description="descr. 40000714"
)
def test_uploadRequirementAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, "r")
with self.assertRaisesRegex(TLResponseError, "6004.*40000712"):
self.client.uploadRequirementAttachment(
attachemantFile, 40000712, title="title 40000713", description="descr. 40000714"
)
def test_uploadTestProjectAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, "r")
with self.assertRaisesRegex(TLResponseError, "7000.*40000712"):
self.client.uploadTestProjectAttachment(
attachemantFile, 40000712, title="title 40000713", description="descr. 40000714"
)
def test_uploadTestSuiteAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, "r")
with self.assertRaisesRegex(TLResponseError, "8000.*40000712"):
self.client.uploadTestSuiteAttachment(
attachemantFile, 40000712, title="title 40000713", description="descr. 40000714"
)
def test_uploadTestCaseAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, "r")
with self.assertRaisesRegex(TLResponseError, "5000.*testcaseid"):
self.client.uploadTestCaseAttachment(
attachemantFile, 40000712, title="title 40000713", description="descr. 40000714"
)
def test_uploadAttachment_unknownID(self):
attachemantFile = open(ATTACHMENT_EXAMPLE_TEXT, "r")
with self.assertRaisesRegex(TLResponseError, "6004.*Invalid Foreign Key ID"):
self.client.uploadAttachment(
attachemantFile, "0000", "nodes_hierarchy", title="title 40000713", description="descr. 40000714"
)
def test_testLinkVersion(self):
response = self.client.testLinkVersion()
self.assertRegex(response, "\d*\.\d*\.\d*")
def test_getUserByLogin_unknownKey(self):
with self.assertRaisesRegex(TLResponseError, "10000.*User Login"):
self.client.getUserByLogin(user="unknownUser")
# def test_setTestMode(self):
# response = self.client.setTestMode(True)
# self.assertTrue(response)
# response = self.client.setTestMode(False)
# self.assertTrue(response)
def test_deleteExecution_unknownKey(self):
try:
response = self.client.deleteExecution(40000711)
# case: TL configuration allows deletion of executions
# response returns Success, even if executionID is unkown
self.assertEqual(
[{"status": True, "message": "Success!", "id": 40000711, "operation": "deleteExecution"}], response
)
except TLResponseError as tl_err:
# case: TL configuration does not allow deletion of executions
# Expects: 232: Configuration does not allow delete executions
self.assertEqual(232, tl_err.code)