def test_intercom_tag_with_disabled_settings(self): """ Test intercom templatetage with intercom disabled and without app_id """ with patch(MODULE_PATCH.format('INTERCOM_DISABLED'), True): self.context['request'] = self.request tag = intercom_tag(self.context) self.assertFalse(tag["INTERCOM_IS_VALID"])
def test_intercom_tag_with_enabled_settings_authenticated_user(self): """ Test intercom templatetage with intercom enabled """ expected = {'INTERCOM_IS_VALID': True, 'intercom_appid': '1234abCD', 'email_address': '', 'user_id': 1, 'name': 'test_user', 'enable_inbox': True, 'use_counter': 'true', 'css_selector': '#Intercom', 'custom_data': '{}', 'company_data': '{}', 'user_hash': None} with patch(MODULE_PATCH.format('INTERCOM_APPID'), '1234abCD'): self.request.user = self.user self.context['request'] = self.request tag_dict = intercom_tag(self.context) # Remove user_created del tag_dict['user_created'] self.assertDictEqual(tag_dict, expected)
def test_intercom_tag_without_request(self): """ Test intercom templatetage without Request """ tag = intercom_tag(self.context) self.assertFalse(tag["INTERCOM_IS_VALID"])