Source

django-facebook-comments / facebook_comments / tests.py

from django.utils import unittest
from django.template import Context, Template
import os

class FBCommentBasicTest(unittest.TestCase):
	def setUp(self):
		self.path = os.environ.get('SITE')
		self.c = Context()
	
	def test_nothing(self):
		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)