def test_persist_single_lead_dict_empty(self): """Test /answer/:id without auth""" try: persist_single_lead({}) assert False except Exception as e: message = str(e) self.assertEqual(message, 'Missing location information') self.assertEqual(self.count_form_entry(), 0)
def test_persist_single_lead_with_bad_location(self): """Test /answer/:id without auth""" try: persist_single_lead({ 'location': 'they-killed-kenny' }) assert False except Exception as e: message = str(e) self.assertEqual(message, 'No academy found with slug they-killed-kenny') self.assertEqual(self.count_form_entry(), 0)
def test_persist_single_lead_with_location(self): """Test /answer/:id without auth""" model = self.generate_models(academy=True, active_campaign_academy=True) try: persist_single_lead({ 'location': model['academy'].slug }) assert False except Exception as e: message = str(e) self.assertEqual(message, 'You need to specify tags for this entry') self.assertEqual(self.count_form_entry(), 0)
def test_persist_single_lead_with_bad_tags(self): """Test /answer/:id without auth""" model = self.generate_models(academy=True, active_campaign_academy=True) try: persist_single_lead({ 'location': model['academy'].slug, 'tags': 'they-killed-kenny' }) assert False except Exception as e: message = str(e) self.assertEqual(message, 'Tag applied to the contact not found or has not tag_type assigned') self.assertEqual(self.count_form_entry(), 0)
def test_persist_single_lead_with_automations(self): """Test /answer/:id without auth""" model = self.generate_models(academy=True, active_campaign_academy=True, tag=True, tag_kwargs={'tag_type': 'STRONG'}, automation=True) try: persist_single_lead({ 'location': model['academy'].slug, 'tags': model['tag'].slug, 'automations': 'they-killed-kenny' }) assert False except Exception as e: message = str(e) self.assertEqual(message, 'The specified automation they-killed-kenny was not found for this AC Academy') self.assertEqual(self.count_form_entry(), 0)
def test_persist_single_lead_with_email(self): """Test /answer/:id without auth""" model = self.generate_models(academy=True, active_campaign_academy=True, tag=True, tag_kwargs={'tag_type': 'STRONG'}, automation=True, automation_kwargs={'slug': 'they-killed-kenny'}) try: persist_single_lead({ 'location': model['academy'].slug, 'tags': model['tag'].slug, 'automations': model['automation'].slug, 'email': '*****@*****.**' }) assert False except Exception as e: message = str(e) self.assertEqual(message, 'The first name doesn\'t exist') self.assertEqual(self.count_form_entry(), 0)
def test_persist_single_lead_with_id(self): """Test /answer/:id without auth""" model = self.generate_models(academy=True, active_campaign_academy=True, tag=True, tag_kwargs={'tag_type': 'STRONG'}, automation=True, automation_kwargs={'slug': 'they-killed-kenny'}) try: persist_single_lead({ 'location': model['academy'].slug, 'tags': model['tag'].slug, 'automations': model['automation'].slug, 'email': '*****@*****.**', 'first_name': 'Konan', 'last_name': 'Amegakure', 'phone': '123123123', 'id': 123123123, }) assert False except Exception as e: message = str(e) self.assertEqual(message, 'FormEntry not found (id: 123123123)') self.assertEqual(self.count_form_entry(), 0)