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)
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_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_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))
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_if_db_authentication_data_is_loaded(self): self.assertEqual(Config.get('DB_PORT'), '5432')
def setUp(self): self._conn = Connection(Config.get('DB_HOST'), Config.get('DB_NAME'), Config.get('DB_USER'), Config.get('DB_PASS')) Config.set('db.conn', self._conn)
def setUp(self): self._conn = Config.get('db.conn')