def test_node(self): r = UserVoiceNode().render(Context()) self.assertIn("widget.uservoice.com/abcdefghijklmnopqrst.js", r)
def test_auto_trigger_custom_win(self): r = UserVoiceNode().render(Context({'uservoice_add_trigger': True})) self.assertTrue("UserVoice.push(['addTrigger', {}]);" in r, r)
def test_auto_trigger(self): r = UserVoiceNode().render(Context()) self.assertFalse("UserVoice.push(['addTrigger', {}]);" in r, r)
def test_override_options(self): data = {'uservoice_widget_options': {'key1': 'val2'}} r = UserVoiceNode().render(Context(data)) self.assertIn("""UserVoice.push(['set', {"key1": "val2"}]);""", r)
def test_options(self): r = UserVoiceNode().render(Context()) self.assertIn("""UserVoice.push(['set', {"key1": "val1"}]);""", r)
def test_overridden_key(self): vars = {'uservoice_widget_key': 'defghijklmnopqrstuvw'} r = UserVoiceNode().render(Context(vars)) self.assertIn("widget.uservoice.com/defghijklmnopqrstuvw.js", r)