view PersonasBackend/personas/tests.py @ 70:9ce4f688108b

Modified the personas json feed to only show published Personas.
author Atul Varma <varmaa@toolness.com>
date Tue, 11 Mar 2008 16:11:10 -0500
parents ec4f7cbb1ae2
children 663f0410ff39
line wrap: on
line source

import unittest

from django.test.client import Client
from PersonasBackend.personas import models

class JsonTests( unittest.TestCase ):
    def setUp( self ):
        for persona in models.Persona.objects.all():
            persona.delete()
        self.cat = models.Category( name = "Random Things" )
        self.cat.save()
        self.persona = models.Persona(
            name = "Test Persona",
            category = self.cat,
            header_img_url = "http://www.blarg.com/myheader.png",
            footer_img_file = "footers/myfooter.png",
            status = "published"
            )
        self.persona.save()

    def tearDown( self ):
        self.persona.delete()
        self.cat.delete()

    def testCategoriesWorks( self ):
        # Just a smoke test to make sure nothing crashes...
        client = Client()
        response = client.get( "/en-US/personas_categories.dat" )
        assert response.status_code == 200

    def testAllPersonasWorks( self ):
        # Just a smoke test to make sure nothing crashes...
        client = Client()
        response = client.get( "/en-US/personas_all.dat" )
        assert response.status_code == 200

if __name__ == "__main__":
    unittest.main()