Skip to content

Commit

Permalink
Merge pull request #105 from Vitiell0/master
Browse files Browse the repository at this point in the history
Updated regex for Intercom APP_ID and tests for Intercom
  • Loading branch information
jcassee committed Feb 22, 2017
2 parents 7da975c + 67ee8bd commit 0b38497
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion analytical/templatetags/intercom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from analytical.utils import disable_html, get_required_setting, \
is_internal_ip, get_user_from_context, get_identity

APP_ID_RE = re.compile(r'[\da-f]+$')
APP_ID_RE = re.compile(r'[\da-z]+$')
TRACKING_CODE = """
<script id="IntercomSettingsScriptTag">
window.intercomSettings = %(settings_json)s;
Expand Down
6 changes: 3 additions & 3 deletions analytical/tests/test_tag_intercom.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from analytical.utils import AnalyticalException


@override_settings(INTERCOM_APP_ID='1234567890abcdef0123456789')
@override_settings(INTERCOM_APP_ID="abc123xyz")
class IntercomTagTestCase(TagTestCase):
"""
Tests for the ``intercom`` template tag.
Expand All @@ -36,7 +36,7 @@ def test_node(self):
# Because the json isn't predictably ordered, we can't just test the whole thing verbatim.
self.assertEqual("""
<script id="IntercomSettingsScriptTag">
window.intercomSettings = {"app_id": "1234567890abcdef0123456789", "created_at": 1397074500, "email": "test@example.com", "name": "Firstname Lastname"};
window.intercomSettings = {"app_id": "abc123xyz", "created_at": 1397074500, "email": "test@example.com", "name": "Firstname Lastname"};
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://static.intercomcdn.com/intercom.v1.js';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
""", rendered_tag)
Expand All @@ -55,7 +55,7 @@ def test_identify_name_email_and_created_at(self):
first_name='Firstname', last_name='Lastname',
email="test@example.com", date_joined=now)}))
self.assertTrue(
"""window.intercomSettings = {"app_id": "1234567890abcdef0123456789", "created_at": 1397074500, "email": "test@example.com", "name": "Firstname Lastname"};"""\
"""window.intercomSettings = {"app_id": "abc123xyz", "created_at": 1397074500, "email": "test@example.com", "name": "Firstname Lastname"};"""\
in r
)

Expand Down

0 comments on commit 0b38497

Please sign in to comment.