Commits

Shu Zong Chen committed 48c20ae

Basic templatetag render tests

Comments (0)

Files changed (1)

facebook_comments/tests.py

 from django.template import Context, Template
 import os
 
-class FBCommentInitTest(unittest.TestCase):
+class FBCommentBasicTest(unittest.TestCase):
 	def setUp(self):
 		self.path = os.environ.get('SITE')
-		t_str = """
-{% load fb_comments %}
-"""
-		self.t = Template(t_str)
+		self.c = Context()
 	
 	def test_nothing(self):
-		c = Context()
-		print self.t.render(c)
+		t_str = """{% load fb_comments %}"""
+		t = Template(t_str)
+		output = t.render(self.c)
+	
+	def test_render(self):
+		t_str = """{% load fb_comments %}{% fb_comments href="http://www.google.com/" %}"""
+		t = Template(t_str)
+		output = t.render(self.c)
 
+		#assert widget actually gets rendered 
+		self.assertTrue("<div class=\"fb-comments\"" in output)
+
+		#assert js is output in this case
+		self.assertTrue("<script>" in output)