def transpile_item_to_domain(self, item): domain = Domain() domain.domain = item['seo']['url'] domain.metadata = item['company'].update(item['address']) return domain
def test_error_inserting_company(self): domain = Domain() domain.domain = 'kanui.com.br' domain.metadata = { 'non-defined-field': False } self.assertFalse(HubSpotService(Config.get('HUBSPOT_HAPIKEY')).insert_company(domain))
def test_error_inserting_entity(self): domainRepository = DomainRepository(self._conn) domain = Domain() domain.metadata = {'street': 'Rua Fidencio Ramos'} self.assertFalse(domainRepository.insert(domain)) self.assertTrue(domainRepository.hasErrors()) print(domainRepository.getErrors())
def test_insert(self): domain = Domain() domain.domain = 'kanui.com.br' domain.metadata = { 'street': 'Rua Fidencio', 'district': 'Vila Olimpia' } self.assertTrue(DomainRepository(self._conn).insert(domain)) Config.set('domain.id', domain.id)
def test_insert_company(self): domain = Domain() domain.domain = 'kanui.com.br' domain.metadata = { 'name': 'Kanui comercio de calçados, roupas e acessórios', 'cnpj': '04.055/0001-32', 'street': 'Rua Santa Justina, 352', 'district': 'Itaim Bibi', 'zipcode': '04545-041', 'city': 'São Paulo', 'state': 'SP' } self.assertTrue(HubSpotService(Config.get('HUBSPOT_HAPIKEY')).insert_company(domain)) self.assertTrue(DomainRepository(self._conn).insert(domain)) Config.set('domain2.id', domain.id)
def map_domain_to_object(self, result): domain = Domain() domain.id = result[0] domain.hubspot_id = result[3] domain.domain = result[1] domain.metadata = result[2] return domain
def test_error_updating_non_existent_entity(self): self.assertFalse(DomainRepository(self._conn).update(Domain()))