Пример #1
0
 def test_render_internal_ip(self):
     req = HttpRequest()
     req.META['REMOTE_ADDR'] = '1.1.1.1'
     context = Context({'request': req})
     r = HubSpotNode().render(context)
     self.assertTrue(r.startswith('<!-- HubSpot disabled on internal IP address'), r)
     self.assertTrue(r.endswith('-->'), r)
Пример #2
0
 def test_render_internal_ip(self):
     req = HttpRequest()
     req.META['REMOTE_ADDR'] = '1.1.1.1'
     context = Context({'request': req})
     r = HubSpotNode().render(context)
     self.assertTrue(r.startswith('<!-- HubSpot disabled on internal IP address'), r)
     self.assertTrue(r.endswith('-->'), r)
Пример #3
0
 def test_render_internal_ip(self):
     self.settings_manager.set(ANALYTICAL_INTERNAL_IPS=['1.1.1.1'])
     req = HttpRequest()
     req.META['REMOTE_ADDR'] = '1.1.1.1'
     context = Context({'request': req})
     r = HubSpotNode().render(context)
     self.assertTrue(r.startswith(
             '<!-- HubSpot disabled on internal IP address'), r)
     self.assertTrue(r.endswith('-->'), r)
Пример #4
0
 def test_node(self):
     r = HubSpotNode().render(Context())
     self.assertTrue(
         "n.id=i;n.src='//js.hs-analytics.net/analytics/'+(Math.ceil(new Date()/r)*r)+'/1234.js';"
         in r, r)
 def test_wrong_portal_id(self):
     with pytest.raises(AnalyticalException):
         HubSpotNode()
Пример #6
0
 def test_node(self):
     r = HubSpotNode().render(Context())
     self.assertTrue('var hs_portalid = 1234;' in r, r)
     self.assertTrue('var hs_ppa = "example.com";' in r, r)