def test_parseSuite(self): in_txt = self.txt.split('\n',1)[1] # Remove first line suite_out = json.loads(self.json_out) self.assertEqual(type(orm.parseSuite(in_txt)), type(suite_out)) self.assertEqual(orm.parseSuite(in_txt)['objects'], suite_out['objects']) #self.assertEqual(orm.parseSuite(self.txt)['description'], suite_out['description']) self.assertEqual(orm.parseSuite(in_txt), suite_out)
def push(filename, credental): with open(filename, 'r') as f: # Determine its type (caseversion? suite?) rtype, rid = orm.parseURL(f.readline( )) # TODO: do we need to extract the first line here? or in parse* if (rtype == 'caseversion'): caseversion = orm.parseCaseversion(''.join(f.readlines())) # Call forcePushCaseversion or forcePushSuite forcePushCaseversion(rid, caseversion, requests, credental) elif (rtype == 'suite'): suite = orm.parseSuite(''.join(f.readlines())) forcePushSuite(rid, suite, requests, credental)
def test_mtapi_create(self): sample_json = orm.parseSuite(self.test_case_sample) for case in sample_json['objects']: #print case['name'] #print case['steps'] #print case['description'] # test_case_obj = mtapi.MozTrapTestCase(case['name'], "testProduct", "1.0") test_case_obj = mtapi.MozTrapTestCase(case['name'], "MozTrap", "0.8") for step in case['steps']: #print step test_case_obj.add_step(step['instruction'], step['expected']) # tag is not working when calling moztrap's REST API!!! test_case_obj.add_tag("testTag", "testDesc") test_case_obj.create()
def convert_mark_file_into_moztrap(filename, credential, product_info=None): set_user_params(credential['username'], credential['api_key']) #TODO if product_info is None: # TODO: read product from test case namespace id product_info = { 'name': config.defaultProduct, 'version': config.defaultVersion } with open(filename, 'r') as f: # Determine its type (caseversion? suite?) cases = orm.parseSuite(''.join(f.readlines())) for case in cases['objects']: # FIXME: HRADCODE v--------------- test_case_obj = MozTrapTestCase(case['name'], product_info['name'], product_info['version']) for step in case['steps']: test_case_obj.add_step(step['instruction'], step['expected']) if test_case_obj.existing_in_moztrap(): test_case_obj.update() else: test_case_obj.create()