File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ """
3+ How do I record when a User has started a new session?
4+ """
5+
6+ import os
7+ import unittest
8+ from intercom import Intercom
9+ from intercom import User
10+
11+ Intercom .app_id = os .environ .get ('INTERCOM_APP_ID' )
12+ Intercom .app_api_key = os .environ .get ('INTERCOM_APP_API_KEY' )
13+
14+
15+ class Issue73Test (unittest .TestCase ):
16+
17+ def test (self ):
18+ user = User .create (email = 'bingo@example.com' )
19+ # store current session count
20+ session_count = user .session_count
21+
22+ # register a new session
23+ user .new_session = True
24+ user .save ()
25+
26+ # count has increased by 1
27+ self .assertEquals (session_count + 1 , user .session_count )
28+
29+ # register a new session
30+ user .new_session = True
31+ user .save ()
32+
33+ # count has increased by 1
34+ self .assertEquals (session_count + 2 , user .session_count )
You can’t perform that action at this time.
0 commit comments