def test_update(self):
        domain = DomainRepository(self._conn).find_by_id(
            Config.get('domain.id'))
        self.assertIsInstance(domain, Domain)

        domain.metadata['seo'] = {'description': 'Hey boys, 50% discount'}

        self.assertTrue(DomainRepository(self._conn).update(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())
Пример #3
0
    def test_error_inserting_deal(self):
        domain = DomainRepository(self._conn).find_by_id(Config.get('domain.id'))

        deal = Deal()
        deal.company = domain
        deal.metadata = {
            'should_bring_what': 'some_error'
        }
        self.assertFalse(HubSpotService(Config.get('HUBSPOT_HAPIKEY')).insert_deal(deal))
    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)
Пример #5
0
    def test_insert_deal(self):
        
        domain = DomainRepository(self._conn).find_by_id(Config.get('domain2.id'))

        dealName = ''
        if 'name' in domain.metadata:
            dealName = domain.metadata['name']

        deal = Deal()
        deal.company = domain
        deal.metadata = {
            'dealname': "Novo negócio com à %s" % dealName,
            'dealtype': 'newbusiness',
            'pipeline': 'default',
            'dealstage': 'appointmentscheduled'
        }
        self.assertTrue(HubSpotService(Config.get('HUBSPOT_HAPIKEY')).insert_deal(deal))
Пример #6
0
    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 test_check_domain_already_exists(self):
     self.assertTrue(
         DomainRepository(
             self._conn).check_if_domain_exists('kanui.com.br'))
 def test_error_updating_non_existent_entity(self):
     self.assertFalse(DomainRepository(self._conn).update(Domain()))
    def test_error_finding_non_existent_entity(self):

        self.assertIsNone(DomainRepository(self._conn).find_by_id(-10))