Exemplo n.º 1
0
 def test_messages(self):
     messages = [
         "welcome_title",
         "chatting_title",
         "unavailable_title",
         "busy_title",
         "away_message",
         "loading_title",
         "welcome_message",
         "busy_message",
         "chat_input_text",
         "name_input_text",
         "email_input_text",
         "offline_note_message",
         "send_button_text",
         "offline_note_thankyou_text",
         "offline_note_error_text",
         "offline_note_sending_text",
         "operator_is_typing_text",
         "operator_has_stopped_typing_text",
         "introduction_error_text",
         "introduction_messages",
         "introduction_submit_button_text",
     ]
     vars = dict(('olark_%s' % m, m) for m in messages)
     r = OlarkNode().render(Context(vars))
     for m in messages:
         self.assertTrue(
             "olark.configure('locale.%s', \"%s\");" % (m, m) in r, r)
Exemplo n.º 2
0
 def test_messages(self):
     messages = [
         "welcome_title",
         "chatting_title",
         "unavailable_title",
         "busy_title",
         "away_message",
         "loading_title",
         "welcome_message",
         "busy_message",
         "chat_input_text",
         "name_input_text",
         "email_input_text",
         "offline_note_message",
         "send_button_text",
         "offline_note_thankyou_text",
         "offline_note_error_text",
         "offline_note_sending_text",
         "operator_is_typing_text",
         "operator_has_stopped_typing_text",
         "introduction_error_text",
         "introduction_messages",
         "introduction_submit_button_text",
     ]
     vars = {f'olark_{m}': m for m in messages}
     r = OlarkNode().render(Context(vars))
     for m in messages:
         assert f"olark.configure('locale.{m}', \"{m}\");" in r
Exemplo n.º 3
0
 def test_status_string_list(self):
     r = OlarkNode().render(
         Context({
             'olark_status': ['teststatus1', 'teststatus2'],
         }))
     self.assertTrue(
         "olark('api.chat.updateVisitorStatus', "
         '{snippet: ["teststatus1", "teststatus2"]});' in r, r)
Exemplo n.º 4
0
 def test_identify(self):
     r = OlarkNode().render(
         Context({
             'user':
             User(username='******', first_name='Test', last_name='User'),
         }))
     self.assertTrue(
         "olark('api.chat.updateVisitorNickname', "
         "{snippet: 'Test User (test)'});" in r, r)
Exemplo n.º 5
0
 def test_identify(self):
     self.settings_manager.set(ANALYTICAL_AUTO_IDENTIFY=True)
     r = OlarkNode().render(
         Context({
             'user':
             User(username='******', first_name='Test', last_name='User')
         }))
     self.assertTrue(
         "olark('api.chat.updateVisitorNickname', "
         "{snippet: 'Test User (test)'});" in r, r)
Exemplo n.º 6
0
 def test_status_string(self):
     r = OlarkNode().render(Context({'olark_status': 'teststatus'}))
     self.assertTrue(
         "olark('api.chat.updateVisitorStatus', "
         '{snippet: "teststatus"});' in r, r)
Exemplo n.º 7
0
 def test_nickname(self):
     r = OlarkNode().render(Context({'olark_nickname': 'testnick'}))
     self.assertTrue(
         "olark('api.chat.updateVisitorNickname', "
         "{snippet: 'testnick'});" in r, r)
Exemplo n.º 8
0
 def test_identify_anonymous_user(self):
     r = OlarkNode().render(Context({'user': AnonymousUser()}))
     self.assertFalse("olark('api.chat.updateVisitorNickname', " in r, r)
Exemplo n.º 9
0
 def test_node(self):
     r = OlarkNode().render(Context())
     self.assertTrue("olark.identify('1234-567-89-0123');" in r, r)
Exemplo n.º 10
0
 def test_wrong_site_id(self):
     with pytest.raises(AnalyticalException):
         OlarkNode()