def test_load_technology_by_id(self): """TechGallery: load technology for id.""" techs, status_code = self.techgallery.profile('mlacerda') self.assertIn('technologies', techs) if 'technologies' in techs: tech = techs['technologies'][0] tech_name = tech['technologyName'] tech_key = techgallery.convert_name_to_id(tech_name) technology, status_code = self.techgallery.technology(tech_key) self.assertEquals(200, status_code) self.assertEquals(tech_key, technology['id']) self.assertIsNotNone(technology['name'])
def get_technology_list(self, sheet_id): """Retrieve a list of tecnologies from sheet_id.""" query = { "query": {"match": { "sheet_id": sheet_id }} } stack = [] data = self.es.search(index=index, body=query, size=1) for project in data['hits']['hits']: item = project['_source'] if 'stack' not in item: logger.warning('spreadsheet %s with no stack' % sheet_id) continue for tech in item['stack']: tech_name = tech if tech_name: tech_key = techgallery.convert_name_to_id(tech_name) tech_key = tech_key.rstrip() image = DEFAULT_IMG_URL # workaround: techgallery image has no pattern for url name # logger.info('tech %s' % tech_key) (tc_tech, status_code) = self.tc.technology(tech_key) if 'image' in tc_tech: logger.debug(tc_tech['image']) image = tc_tech['image'] else: logger.debug('technology not found %s' % tc_tech) doc_tech = { "technology": tech_key, "technologyName": tech_name, "imageUrl": image } # add new tech definition stack.append(doc_tech) return stack
def test_name_with_no_ascii(self): """TechGallery: Test converter for name with no-ascii character.""" tech_name = 'Java API for XML (JAX-WS)' tech_key = techgallery.convert_name_to_id(tech_name) self.assertEquals('java_api_for_xml_(jax-ws)', tech_key)
def test_name_with_space(self): """TechGallery: Test converter for name with space character.""" tech_name = 'Angular JS' tech_key = techgallery.convert_name_to_id(tech_name) self.assertEquals('angular_js', tech_key)
def test_name_black_list(self): """TechGallery: Test converter for blacklist calabash.""" tech_name = 'calabash' tech_key = techgallery.convert_name_to_id(tech_name) self.assertEquals('cabalash', tech_key)
def test_name_with_dot(self): """TechGallery: Test converter for name with dot character.""" tech_name = 'VB .Net' tech_key = techgallery.convert_name_to_id(tech_name) self.assertEquals('vb_net', tech_key)