コード例 #1
0
class TestLinkAPIOfflineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
    works with DummyAPIClientm which returns special test data
    """

    def setUp(self):
        self.api = TestLinkHelper().connect(DummyAPIClient)

#    def tearDown(self):
#        pass


    def test_countProjects(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countProjects()
        self.assertEqual(2, response)
        
    def test_countTestPlans(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestPlans()
        self.assertEqual(1, response)
        
    def test_countTestSuites(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestSuites()
        self.assertEqual(0, response)
        
    def test_countTestCasesTP(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTP()
        self.assertEqual(0, response)
        
    def test_countTestCasesTS(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTS()
        self.assertEqual(0, response)

    def test_countPlatforms(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countPlatforms()
        self.assertEqual(0, response)
        
    def test_countBuilds(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countBuilds()
        self.assertEqual(0, response)

#    def test_listProjects(self):
#        self.api.loadScenario(SCENARIO_A)
#        self.api.listProjects()
#         no assert check cause method returns nothing
#         'just' prints to stdout
        
    def test_getProjectIDByName(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.getProjectIDByName('NEW_PROJECT_API')
        self.assertEqual('21', response)
        response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
        self.assertEqual(-1, response)
コード例 #2
0
class TestLinkAPIOfflineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
    works with DummyAPIClientm which returns special test data
    """
    def setUp(self):
        self.api = TestLinkHelper().connect(DummyAPIClient)

#    def tearDown(self):
#        pass

    def test_countProjects(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countProjects()
        self.assertEqual(2, response)

    def test_countTestPlans(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestPlans()
        self.assertEqual(1, response)

    def test_countTestSuites(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestSuites()
        self.assertEqual(0, response)

    def test_countTestCasesTP(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTP()
        self.assertEqual(0, response)

    def test_countTestCasesTS(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTS()
        self.assertEqual(0, response)

    def test_countPlatforms(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countPlatforms()
        self.assertEqual(0, response)

    def test_countBuilds(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countBuilds()
        self.assertEqual(0, response)


#    def test_listProjects(self):
#        self.api.loadScenario(SCENARIO_A)
#        self.api.listProjects()
#         no assert check cause method returns nothing
#         'just' prints to stdout

    def test_getProjectIDByName(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.getProjectIDByName('NEW_PROJECT_API')
        self.assertEqual('21', response)
        response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
        self.assertEqual(-1, response)
class TestLinkAPIOfflineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
    works with DummyAPIClientm which returns special test data
    """

    example_steps = [{'step_number' : '1', 'actions' : "action A" , 
                'expected_results' : "result A", 'execution_type' : "0"},
                 {'step_number' : '2', 'actions' : "action B" , 
                'expected_results' : "result B", 'execution_type' : "1"},
                 {'step_number' : '3', 'actions' : "action C" , 
                'expected_results' : "result C", 'execution_type' : "0"}]
    def setUp(self):
        self.api = TestLinkHelper().connect(DummyAPIClient)

#    def tearDown(self):
#        pass


    def test_countProjects(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countProjects()
        self.assertEqual(2, response)
        
    def test_countTestPlans(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestPlans()
        self.assertEqual(2, response)
        
    def test_countTestSuites(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestSuites()
        self.assertEqual(0, response)
        
    def test_countTestCasesTP(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTP()
        self.assertEqual(0, response)
        
    def test_countTestCasesTS(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTS()
        self.assertEqual(0, response)

    def test_countPlatforms(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countPlatforms()
        self.assertEqual(2, response)
        
    def test_countBuilds(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countBuilds()
        self.assertEqual(0, response)

#    def test_listProjects(self):
#        self.api.loadScenario(SCENARIO_A)
#        self.api.listProjects()
#         no assert check cause method returns nothing
#         'just' prints to stdout
        
    def test_getProjectIDByName(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.getProjectIDByName('NEW_PROJECT_API')
        self.assertEqual('21', response)
        response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
        self.assertEqual(-1, response)
        
    def test_initStep(self):
        self.api.initStep("action A", "result A", 0)
        steps = self.example_steps[:1]
        self.assertEqual(steps, self.api.stepsList)
        
    def test_appendStep(self):
        steps = self.example_steps
        self.api.stepsList = steps[:1] 
        self.api.appendStep("action B", "result B", 1)
        self.api.appendStep("action C", "result C", 0)
        self.assertEqual(steps, self.api.stepsList)

    def test_createTestCaseWithSteps(self):
        self.api.loadScenario(SCENARIO_STEPS)
        self.api.initStep("action A", "result A", 0)
        self.api.appendStep("action B", "result B", 1)
        self.api.appendStep("action C", "result C", 0)
        self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird', 
                                'summary 4714')
        self.assertEqual(self.example_steps, self.api.callArgs['steps'])
        self.assertEqual([], self.api.stepsList)
        
    def test_getTestCaseIDByName_dictResult(self):
        "test that getTestCaseIDByName converts dictionary result into a list"
        self.api.loadScenario(SCENARIO_A)
        # v0.4.0 version for optional args testsuitename + testprojectname
        #response = self.api.getTestCaseIDByName('dictResult', None, 'NEW_PROJECT_API')
        # v0.4.5 version
        response = self.api.getTestCaseIDByName('dictResult', 
                                            testprojectname='NEW_PROJECT_API')
        self.assertEqual(list, type(response))
        self.assertEqual('TESTCASE_B', response[0]['name']) 
        self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
        
    def test_getTestCaseIDByName_listResult(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.getTestCaseIDByName('listResult')
        self.assertEqual(list, type(response))
        self.assertEqual('TESTCASE_AA', response[0]['name']) 
        self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
コード例 #4
0
class TestLinkAPIOfflineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
    works with DummyAPIClientm which returns special test data
    """

    example_steps = [{'step_number' : '1', 'actions' : "action A" , 
                'expected_results' : "result A", 'execution_type' : "0"},
                 {'step_number' : '2', 'actions' : "action B" , 
                'expected_results' : "result B", 'execution_type' : "1"},
                 {'step_number' : '3', 'actions' : "action C" , 
                'expected_results' : "result C", 'execution_type' : "0"}]
    def setUp(self):
        self.api = TestLinkHelper().connect(DummyAPIClient)

#    def tearDown(self):
#        pass


    def test_countProjects(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countProjects()
        self.assertEqual(2, response)
        
    def test_countTestPlans(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestPlans()
        self.assertEqual(2, response)
        
    def test_countTestSuites(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestSuites()
        self.assertEqual(0, response)
        
    def test_countTestCasesTP(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTP()
        self.assertEqual(0, response)
        
    def test_countTestCasesTS(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTS()
        self.assertEqual(0, response)

    def test_countPlatforms(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countPlatforms()
        self.assertEqual(2, response)
        
    def test_countBuilds(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countBuilds()
        self.assertEqual(0, response)

#    def test_listProjects(self):
#        self.api.loadScenario(SCENARIO_A)
#        self.api.listProjects()
#         no assert check cause method returns nothing
#         'just' prints to stdout
        
    def test_getProjectIDByName(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.getProjectIDByName('NEW_PROJECT_API')
        self.assertEqual('21', response)
        response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
        self.assertEqual(-1, response)
        
    def test_initStep(self):
        self.api.initStep("action A", "result A", 0)
        steps = self.example_steps[:1]
        self.assertEqual(steps, self.api.stepsList)
        
    def test_appendStep(self):
        steps = self.example_steps
        self.api.stepsList = steps[:1] 
        self.api.appendStep("action B", "result B", 1)
        self.api.appendStep("action C", "result C", 0)
        self.assertEqual(steps, self.api.stepsList)

    def test_createTestCaseWithSteps(self):
        self.api.loadScenario(SCENARIO_STEPS)
        self.api.initStep("action A", "result A", 0)
        self.api.appendStep("action B", "result B", 1)
        self.api.appendStep("action C", "result C", 0)
        self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird', 
                                'summary 4714')
        self.assertEqual(self.example_steps, self.api.callArgs['steps'])
        self.assertEqual([], self.api.stepsList)

    def test_createTestCaseWithConfusingSteps(self):
        self.api.loadScenario(SCENARIO_STEPS)
        self.api.initStep("action A", "result A", 0)
        self.api.appendStep("action B", "result B", 1)
        self.api.appendStep("action C", "result C", 0)
        with self.assertRaisesRegexp(TLArgError, 'confusing createTestCase*'):
            self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird', 
                                    'summary 4714', steps=[])
        
    def test_getTestCaseIDByName_dictResult(self):
        "test that getTestCaseIDByName converts dictionary result into a list"
        self.api.loadScenario(SCENARIO_A)
        # v0.4.0 version for optional args testsuitename + testprojectname
        #response = self.api.getTestCaseIDByName('dictResult', None, 'NEW_PROJECT_API')
        # v0.4.5 version
        response = self.api.getTestCaseIDByName('dictResult', 
                                            testprojectname='NEW_PROJECT_API')
        self.assertEqual(list, type(response))
        self.assertEqual('TESTCASE_B', response[0]['name']) 
        self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
        
    def test_getTestCaseIDByName_listResult(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.getTestCaseIDByName('listResult')
        self.assertEqual(list, type(response))
        self.assertEqual('TESTCASE_AA', response[0]['name']) 
        self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
        
    def test_getProjectIDByNode(self):
        self.api.loadScenario(SCENARIO_A)
        self.assertEqual('2211', self.api.getProjectIDByNode('4711'))
        
    def test__copyTC_generate_new(self):
        self.api.loadScenario(SCENARIO_A)
        self.api._copyTC('26', {}, duplicateaction = 'generate_new')
        self.assertEqual('generate_new',  
                         self.api.callArgs['actiononduplicatedname'])

    def test__copyTC_create_new_version(self):
        self.api.loadScenario(SCENARIO_A)
        self.api._copyTC('26', {}, duplicateaction = 'create_new_version')
        self.assertEqual('create_new_version',  
                         self.api.callArgs['actiononduplicatedname'])
        self.assertEqual('V2 None', self.api.callArgs['preconditions'])

    def test__copyTC_changedArgs(self):
        self.api.loadScenario(SCENARIO_A)
        self.api._copyTC('26', {'testsuiteid' :'4711'}, 
                         duplicateaction = 'generate_new')
        self.assertEqual('4711', self.api.callArgs['testsuiteid'])
        self.assertEqual('2211', self.api.callArgs['testprojectid'])

    def test__copyTC_changedArgs_version(self):
        self.api.loadScenario(SCENARIO_A)
        self.api._copyTC('26', {'testsuiteid' :'4711'}, 1,
                         duplicateaction = 'generate_new')
        self.assertEqual('4711', self.api.callArgs['testsuiteid'])
        self.assertEqual('2211', self.api.callArgs['testprojectid'])
        self.assertEqual('V1', self.api.callArgs['preconditions'])
        

    def test_copyTCnewVersion(self):
        self.api.loadScenario(SCENARIO_A)
        self.api.copyTCnewVersion('26', summary = 'The summary has changed', 
                                    importance = '33')
        self.assertEqual('create_new_version',  
                         self.api.callArgs['actiononduplicatedname'])
        self.assertEqual('V2 None', 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_copyTCnewVersion_version(self):
        self.api.loadScenario(SCENARIO_A)
        self.api.copyTCnewVersion('26', 1, summary = 'The summary has changed', 
                                    importance = '33')
        self.assertEqual('create_new_version',  
                         self.api.callArgs['actiononduplicatedname'])
        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='******') 
        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)
        response = self.api.listKeywordsForTC('NPROAPI-3')
        self.assertEqual(['KeyWord02'], response)

    def test_listKeywordsForTC_None(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTC('NPROAPI-4')
        self.assertEqual([], response)
        
    def test_listKeywordsForTS_NoneTC(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTS('noTestCase')
        self.assertEqual({}, response)

    def test_listKeywordsForTS_NoneKW(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTS('noKeywords')
        self.assertEqual({'8144' : []}, response)
        
    def test_listKeywordsForTS_Id_Int(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTS(4711)
        self.assertEqual({'8144' : ['KeyWord01', 'KeyWord03']}, response)
        
    def test_listKeywordsForTS_Id_String(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTS('4711')
        self.assertEqual({'8144' : ['KeyWord01', 'KeyWord03']}, response)
       
    def test_listKeywordsForTS_Multi(self):
        self.api.loadScenario(SCENARIO_KEYWORDS)
        response = self.api.listKeywordsForTS('deepFalse3')
        self.assertEqual({'8144' : ['KeyWord01', 'KeyWord03'],
                          '8159' : ['KeyWord02'], '8169' : []}, response)
        
    def test_whatArgs_getLastExecutionResult(self):
        argsDescription = self.api.whatArgs('getLastExecutionResult')
        self.assertIn('options=<options>', argsDescription)
        self.assertIn('getBugs', argsDescription)
コード例 #5
0
class TestLinkAPIOfflineTestCase(unittest.TestCase):
    """ TestCases for TestlinkAPIClient - does not interacts with a TestLink Server.
    works with DummyAPIClientm which returns special test data
    """

    example_steps = [{'step_number' : '1', 'actions' : "action A" , 
                'expected_results' : "result A", 'execution_type' : "0"},
                 {'step_number' : '2', 'actions' : "action B" , 
                'expected_results' : "result B", 'execution_type' : "1"},
                 {'step_number' : '3', 'actions' : "action C" , 
                'expected_results' : "result C", 'execution_type' : "0"}]
    def setUp(self):
        self.api = TestLinkHelper().connect(DummyAPIClient)

#    def tearDown(self):
#        pass


    def test_countProjects(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countProjects()
        self.assertEqual(2, response)
        
    def test_countTestPlans(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestPlans()
        self.assertEqual(2, response)
        
    def test_countTestSuites(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestSuites()
        self.assertEqual(0, response)
        
    def test_countTestCasesTP(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTP()
        self.assertEqual(0, response)
        
    def test_countTestCasesTS(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countTestCasesTS()
        self.assertEqual(0, response)

    def test_countPlatforms(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countPlatforms()
        self.assertEqual(2, response)
        
    def test_countBuilds(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.countBuilds()
        self.assertEqual(0, response)

#    def test_listProjects(self):
#        self.api.loadScenario(SCENARIO_A)
#        self.api.listProjects()
#         no assert check cause method returns nothing
#         'just' prints to stdout
        
    def test_getProjectIDByName(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.getProjectIDByName('NEW_PROJECT_API')
        self.assertEqual('21', response)
        response = self.api.getProjectIDByName('UNKNOWN_PROJECT')
        self.assertEqual(-1, response)
        
    def test_initStep(self):
        self.api.initStep("action A", "result A", 0)
        steps = self.example_steps[:1]
        self.assertEqual(steps, self.api.stepsList)
        
    def test_appendStep(self):
        steps = self.example_steps
        self.api.stepsList = steps[:1] 
        self.api.appendStep("action B", "result B", 1)
        self.api.appendStep("action C", "result C", 0)
        self.assertEqual(steps, self.api.stepsList)

    def test_createTestCaseWithSteps(self):
        self.api.loadScenario(SCENARIO_STEPS)
        self.api.initStep("action A", "result A", 0)
        self.api.appendStep("action B", "result B", 1)
        self.api.appendStep("action C", "result C", 0)
        self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird', 
                                'summary 4714')
        self.assertEqual(self.example_steps, self.api.callArgs['steps'])
        self.assertEqual([], self.api.stepsList)

    def test_createTestCaseWithConfusingSteps(self):
        self.api.loadScenario(SCENARIO_STEPS)
        self.api.initStep("action A", "result A", 0)
        self.api.appendStep("action B", "result B", 1)
        self.api.appendStep("action C", "result C", 0)
        with self.assertRaisesRegexp(TLArgError, 'confusing createTestCase*'):
            self.api.createTestCase('case 4711', 4712, 4713, 'Big Bird', 
                                    'summary 4714', steps=[])
        
    def test_getTestCaseIDByName_dictResult(self):
        "test that getTestCaseIDByName converts dictionary result into a list"
        self.api.loadScenario(SCENARIO_A)
        # v0.4.0 version for optional args testsuitename + testprojectname
        #response = self.api.getTestCaseIDByName('dictResult', None, 'NEW_PROJECT_API')
        # v0.4.5 version
        response = self.api.getTestCaseIDByName('dictResult', 
                                            testprojectname='NEW_PROJECT_API')
        self.assertEqual(list, type(response))
        self.assertEqual('TESTCASE_B', response[0]['name']) 
        self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
        
    def test_getTestCaseIDByName_listResult(self):
        self.api.loadScenario(SCENARIO_A)
        response = self.api.getTestCaseIDByName('listResult')
        self.assertEqual(list, type(response))
        self.assertEqual('TESTCASE_AA', response[0]['name']) 
        self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
        
    def test_getProjectIDByNode(self):
        self.api.loadScenario(SCENARIO_A)
        self.assertEqual('2211', self.api.getProjectIDByNode('4711'))
        
    def test__copyTC_generate_new(self):
        self.api.loadScenario(SCENARIO_A)
        self.api._copyTC('26', {}, duplicateaction = 'generate_new')
        self.assertEqual('generate_new',  
                         self.api.callArgs['actiononduplicatedname'])

    def test__copyTC_create_new_version(self):
        self.api.loadScenario(SCENARIO_A)
        self.api._copyTC('26', {}, duplicateaction = 'create_new_version')
        self.assertEqual('create_new_version',  
                         self.api.callArgs['actiononduplicatedname'])
        self.assertEqual('V2 None', self.api.callArgs['preconditions'])

    def test__copyTC_changedArgs(self):
        self.api.loadScenario(SCENARIO_A)
        self.api._copyTC('26', {'testsuiteid' :'4711'}, 
                         duplicateaction = 'generate_new')
        self.assertEqual('4711', self.api.callArgs['testsuiteid'])
        self.assertEqual('2211', self.api.callArgs['testprojectid'])

    def test__copyTC_changedArgs_version(self):
        self.api.loadScenario(SCENARIO_A)
        self.api._copyTC('26', {'testsuiteid' :'4711'}, 1,
                         duplicateaction = 'generate_new')
        self.assertEqual('4711', self.api.callArgs['testsuiteid'])
        self.assertEqual('2211', self.api.callArgs['testprojectid'])
        self.assertEqual('V1', self.api.callArgs['preconditions'])
        

    def test_copyTCnewVersion(self):
        self.api.loadScenario(SCENARIO_A)
        self.api.copyTCnewVersion('26', summary = 'The summary has changed', 
                                    importance = '33')
        self.assertEqual('create_new_version',  
                         self.api.callArgs['actiononduplicatedname'])
        self.assertEqual('V2 None', 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_copyTCnewVersion_version(self):
        self.api.loadScenario(SCENARIO_A)
        self.api.copyTCnewVersion('26', 1, summary = 'The summary has changed', 
                                    importance = '33')
        self.assertEqual('create_new_version',  
                         self.api.callArgs['actiononduplicatedname'])
        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'])