当前位置: 首页>>代码示例>>Python>>正文


Python TestLinkHelper.whatArgs方法代码示例

本文整理汇总了Python中testlink.TestLinkHelper.whatArgs方法的典型用法代码示例。如果您正苦于以下问题:Python TestLinkHelper.whatArgs方法的具体用法?Python TestLinkHelper.whatArgs怎么用?Python TestLinkHelper.whatArgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testlink.TestLinkHelper的用法示例。


在下文中一共展示了TestLinkHelper.whatArgs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestLinkAPIOfflineTestCase

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import whatArgs [as 别名]

#.........这里部分代码省略.........
        self.assertEqual('V1', self.api.callArgs['preconditions'])
        self.assertEqual('The summary has changed', self.api.callArgs['summary'])
        self.assertEqual('33', self.api.callArgs['importance'])
        self.assertEqual('TC-C', self.api.callArgs['testcasename'])
        self.assertEqual('25', self.api.callArgs['testsuiteid'])
        self.assertEqual('21', self.api.callArgs['testprojectid'])

    def test_copyTCnewTestCase(self):
        self.api.loadScenario(SCENARIO_A)
        self.api.copyTCnewTestCase('26', testsuiteid = '4711')
        self.assertEqual('generate_new',  
                         self.api.callArgs['actiononduplicatedname'])
        self.assertEqual('V2 None', self.api.callArgs['preconditions'])
        self.assertEqual('4711', self.api.callArgs['testsuiteid'])
        self.assertEqual('2211', self.api.callArgs['testprojectid'])

    def test_copyTCnewTestCase_version(self):
        self.api.loadScenario(SCENARIO_A)
        self.api.copyTCnewTestCase('26', 1, testsuiteid = '4711')
        self.assertEqual('generate_new',  
                         self.api.callArgs['actiononduplicatedname'])
        self.assertEqual('V1', self.api.callArgs['preconditions'])
        self.assertEqual('4711', self.api.callArgs['testsuiteid'])
        self.assertEqual('2211', self.api.callArgs['testprojectid'])

    def test_reportTCResult_user(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.reportTCResult(4711, 4712, 'build 4713', 'p', 
                                           'note 4714', user='a login name') 
        self.assertEqual('reportTCResult', response[0]['operation']) 
        self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
        self.assertEqual('a login name', self.api.callArgs['user'])
        
    def test_whatArgs_reportTCResult(self):
        argsDescription = self.api.whatArgs('reportTCResult')
        self.assertIn('user=<user>', argsDescription)

    def test_getTestCasesForTestSuite_keyWords(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.getTestCasesForTestSuite('deepFalse3', False, 
                                                     'full', getkeywords=True)
        self.assertIn('keywords', response[0])
        self.assertNotIn('keywords', response[2])
        self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
           
    def test_whatArgs_getTestCasesForTestSuite(self):
        argsDescription = self.api.whatArgs('getTestCasesForTestSuite')
        self.assertIn('getkeywords=<getkeywords>', argsDescription)
        
    def test_listKeywordsForTC_FullExternalId(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTC('NPROAPI-2')
        self.assertEqual(['KeyWord01', 'KeyWord03'], response)
        
    def test_listKeywordsForTC_InternalId_Int(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTC(8144)
        self.assertEqual(['KeyWord01', 'KeyWord03'], response)
        
    def test_listKeywordsForTC_InternalId_String(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTC('8144')
        self.assertEqual(['KeyWord01', 'KeyWord03'], response)
        
    def test_listKeywordsForTC_One(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
开发者ID:Maberi,项目名称:TestLink-API-Python-client,代码行数:70,代码来源:testlinkapi_offline_test.py

示例2: TestLinkAPIGenericOfflineTestCase

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import whatArgs [as 别名]
class TestLinkAPIGenericOfflineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIGeneric - does not interacts with a TestLink Server.
    works with DummyAPIGeneric which returns special test data
    """

    def setUp(self):
        self.api = TestLinkHelper().connect(DummyAPIGeneric)
        self.callArgs = None
        
#    def tearDown(self):
#        pass


    def test_convertPositionalArgs(self):
        response = self.api._convertPostionalArgs('DummyMethod',  [1,2,3])
        self.assertEqual({'Uno' : 1, 'due' :2, 'tre' : 3}, response)
        
    def test__convertPositionalArgs_missingConf(self):
        client = self.api
        def a_func(a_api): a_api._convertPostionalArgs('NoConfigMethod',  [1,2])
        self.assertRaises(TLArgError, a_func, client)
        
    def test__convertPositionalArgs_lessValues(self):
        client = self.api
        def a_func(a_api): a_api._convertPostionalArgs('DummyMethod',  [1,2])
        self.assertRaises(TLArgError, a_func, client)
        
    def test__convertPositionalArgs_moreValues(self):
        client = self.api
        def a_func(a_api): a_api._convertPostionalArgs('DummyMethod',  [1,2,3,4])
        self.assertRaises(TLArgError, a_func, client)

    def test_callServerWithPosArgs_pos(self):
        self.api.callServerWithPosArgs('DummyMethod',  1,2,3)
        self.assertEqual({'Uno' : 1, 'due' :2, 'tre' : 3}, self.api.callArgs)

    def test_callServerWithPosArgs_pos_opt(self):
        self.api.callServerWithPosArgs('DummyMethod',  1,2,3, quad=4)
        self.assertEqual({'Uno' : 1, 'due' :2, 'tre' : 3, 'quad' : 4}, self.api.callArgs)

    def test_callServerWithPosArgs_opt(self):
        self.api.callServerWithPosArgs('DummyMethod',  quad=4)
        self.assertEqual({'quad' : 4}, self.api.callArgs)

    def test_callServerWithPosArgs_none(self):
        self.api.callServerWithPosArgs('DummyMethod')
        self.assertEqual({}, self.api.callArgs)
        
    def test_checkResponse_emptyResponse(self):
        client = self.api
        def a_func(a_api, response): 
            a_api._checkResponse(response, 'DummyMethod',  
                                 {'Uno' : 1, 'due' :2, 'tre' : 3})
        self.assertRaises(TLResponseError, a_func, client, '')
        self.assertRaises(TLResponseError, a_func, client, [])
        
    def test_checkResponse_errorResponse(self):
        client = self.api
        responseA = [{'message': '(reportTCResult) - TC ID 709 does not exist!', 
                      'code': 5000}]
        def a_func(a_api, response): 
            a_api._checkResponse(response, 'DummyMethod',  
                                 {'Uno' : 1, 'due' :2, 'tre' : 3})
        self.assertRaises(TLResponseError, a_func, client, responseA)

    def test_checkResponse_okResponse(self):
        self.api._checkResponse(
                        [{'message': 'all fine, cause no key with name code'}],
                         'DummyMethod', {'Uno' : 1, 'due' :2, 'tre' : 3})
        self.api._checkResponse(
                        'some API Call juts returns one string without codes',
                         'DummyMethod', {'Uno' : 1, 'due' :2, 'tre' : 3})
        
    def test_checkResponse_booleanResponse(self):
        response = True
        self.api._checkResponse(response, 'DummyMethod', 
                                {'Uno' : 1, 'due' :2, 'tre' : 3})
        
    def test_checkResponse_dictionaryResponse(self):
        response = {'note' : 'uploadAttachment Calls return {..} and not [{..}]'}
        self.api._checkResponse(response, 'DummyMethod', 
                                {'Uno' : 1, 'due' :2, 'tre' : 3})
        
    def test_checkResponse_errorResponse_sringCode(self):
        client = self.api
        
        responseA = [{'message': '(getUserByID) - Cannot Find User with DB ID (4711).', 
                      'code': 'NO_USER_BY_ID_LOGIN'}]
        def a_func(a_api, response): 
            a_api._checkResponse(response, 'getUserByID',  
                                 {'userid' : 4711})
        self.assertRaises(TLResponseError, a_func, client, responseA)

    def test__apiMethodArgNames_noArgs(self):
        response = self.api._apiMethodArgNames('sayHello')
        self.assertEqual(response, ([], [], []))

    def test_whatArgs_noArgs(self):
        response = self.api.whatArgs('sayHello')
        self.assertRegex(response, 'sayHello().*')
#.........这里部分代码省略.........
开发者ID:manojpkr,项目名称:TestLink-API-Python-client,代码行数:103,代码来源:testlinkapigeneric_offline_test.py

示例3: TestLinkAPIGenericOfflineTestCase

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import whatArgs [as 别名]
class TestLinkAPIGenericOfflineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIGeneric - does not interacts with a TestLink Server.
    works with DummyAPIGeneric which returns special test data
    """

    def setUp(self):
        self.api = TestLinkHelper().connect(DummyAPIGeneric)
        self.callArgs = None
        
#    def tearDown(self):
#        pass


    def test_convertPositionalArgs(self):
        response = self.api._convertPostionalArgs('DummyMethod',  [1,2,3])
        self.assertEqual({'Uno' : 1, 'due' :2, 'tre' : 3}, response)
        
    def test__convertPositionalArgs_missingConf(self):
        client = self.api
        def a_func(a_api): a_api._convertPostionalArgs('NoConfigMethod',  [1,2])
        self.assertRaises(TLArgError, a_func, client)
        
    def test__convertPositionalArgs_lessValues(self):
        client = self.api
        def a_func(a_api): a_api._convertPostionalArgs('DummyMethod',  [1,2])
        self.assertRaises(TLArgError, a_func, client)
        
    def test__convertPositionalArgs_moreValues(self):
        client = self.api
        def a_func(a_api): a_api._convertPostionalArgs('DummyMethod',  [1,2,3,4])
        self.assertRaises(TLArgError, a_func, client)

    def test_callServerWithPosArgs_pos(self):
        self.api.callServerWithPosArgs('DummyMethod',  1,2,3)
        self.assertEqual({'Uno' : 1, 'due' :2, 'tre' : 3}, self.api.callArgs)

    def test_callServerWithPosArgs_pos_opt(self):
        self.api.callServerWithPosArgs('DummyMethod',  1,2,3, quad=4)
        self.assertEqual({'Uno' : 1, 'due' :2, 'tre' : 3, 'quad' : 4}, self.api.callArgs)

    def test_callServerWithPosArgs_opt(self):
        self.api.callServerWithPosArgs('DummyMethod',  quad=4)
        self.assertEqual({'quad' : 4}, self.api.callArgs)

    def test_callServerWithPosArgs_none(self):
        self.api.callServerWithPosArgs('DummyMethod')
        self.assertEqual({}, self.api.callArgs)
        
    def test_checkResponse_emptyResponse(self):
        client = self.api
        def a_func(a_api, response): 
            a_api._checkResponse(response, 'DummyMethod',  
                                 {'Uno' : 1, 'due' :2, 'tre' : 3})
        self.assertRaises(TLResponseError, a_func, client, '')
        self.assertRaises(TLResponseError, a_func, client, [])
        
    def test_checkResponse_errorResponse(self):
        client = self.api
        responseA = [{'message': '(reportTCResult) - TC ID 709 does not exist!', 
                      'code': 5000}]
        def a_func(a_api, response): 
            a_api._checkResponse(response, 'DummyMethod',  
                                 {'Uno' : 1, 'due' :2, 'tre' : 3})
        self.assertRaises(TLResponseError, a_func, client, responseA)

    def test_checkResponse_okResponse(self):
        self.api._checkResponse(
                        [{'message': 'all fine, cause no key with name code'}],
                         'DummyMethod', {'Uno' : 1, 'due' :2, 'tre' : 3})
        self.api._checkResponse(
                        'some API Call juts returns one string without codes',
                         'DummyMethod', {'Uno' : 1, 'due' :2, 'tre' : 3})
        
    def test_checkResponse_booleanResponse(self):
        response = True
        self.api._checkResponse(response, 'DummyMethod', 
                                {'Uno' : 1, 'due' :2, 'tre' : 3})
        
    def test_checkResponse_dictionaryResponse(self):
        response = {'note' : 'uploadAttachment Calls return {..} and not [{..}]'}
        self.api._checkResponse(response, 'DummyMethod', 
                                {'Uno' : 1, 'due' :2, 'tre' : 3})
        
    def test_checkResponse_errorResponse_sringCode(self):
        client = self.api
        
        responseA = [{'message': '(getUserByID) - Cannot Find User with DB ID (4711).', 
                      'code': 'NO_USER_BY_ID_LOGIN'}]
        def a_func(a_api, response): 
            a_api._checkResponse(response, 'getUserByID',  
                                 {'userid' : 4711})
        self.assertRaises(TLResponseError, a_func, client, responseA)

    def test__apiMethodArgNames_noArgs(self):
        response = self.api._apiMethodArgNames('sayHello')
        self.assertEqual(response, ([], [], []))

    def test_whatArgs_noArgs(self):
        response = self.api.whatArgs('sayHello')
        self.assertRegexpMatches(response, 'sayHello().*')
#.........这里部分代码省略.........
开发者ID:charz,项目名称:TestLink-API-Python-client,代码行数:103,代码来源:testlinkapigeneric_offline_test.py


注:本文中的testlink.TestLinkHelper.whatArgs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。