# Path: easymode/tests/models.py
# class TestModel(models.Model):
#     "Used in lots of test"
# 
#     charfield = models.CharField(max_length=255, unique=True)
#     tags = models.ManyToManyField('TagModel', related_name='testmodels')
#     
#     def __unicode__(self):
#         return u"%s%s - %s" % (self.__class__.__name__, self.pk, self.charfield)
# 
#     def natural_key(self):
#         return (self.charfield,)
# 
# Path: easymode/utils/languagecode.py
# def get_language_codes():
#     """
#     Retrieves all the language codes defined in ``settings.LANGUAGES``.
#     
#     >>> settings.LANGUAGES = (('en','English'),('de','German'),('nl-be','Belgium dutch'),('fr-be','Belgium french'),)
#     >>> sorted( get_language_codes() )
#     ['de', 'en', 'fr-be', 'nl-be']
#     
#     :rtype: A :class:`list` of language codes.
#     """
#     return dict(settings.LANGUAGES).keys()


from django.http import HttpResponse
from django.template.loader import find_template_source
from django.test import TestCase
from easymode.tree import xml as tree
from easymode.tests.models import TestModel
from easymode.tests.testcases import initdb
from easymode.utils.languagecode import get_language_codes
from easymode.xslt import response
        t = TestModel(charfield='Hoi Ik ben de root node')
        t.save()
        f = t.submodels.create(subcharfield="Hoi Ik ben de first level sub node", subintegerfield=10)
        s = t.submodels.create(subcharfield="Hoi ik ben de tweede first level sub node", subintegerfield=100)
        w = t.secondsubmodels.create(ultrafield="Sed tempor. Ut felis. Maecenas erat.")
        f.subsubmodels.create(subsubcharfield="Hoi ik ben de thord level sub node")
        f.subsubmodels.create(subsubcharfield="Hoi ik ben de third level sub node")
        s.subsubmodels.create(subsubcharfield="Hoi ik ben de third level sub node")
        s.subsubmodels.create(subsubcharfield="Hoi ik ben de third level sub node")        
        t.save()
    
    def test_xsl_template_can_be_found(self):
        """docstring for test_xsl_template_can_be_found"""
        template = find_template_source('xslt/model-to-xml.xsl')
        assert(template)

    def test_xslt_template_will_render_one_object(self):
        """docstring for test_xslt_template_will_render"""
        data = TestModel.objects.get(pk=1)
        resp = response.render_to_response('xslt/model-to-xml.xsl', data)
        assert(resp)

    def test_xslt_changes_the_xml(self):
        """docstring for test_xslt_changes_the_xml"""
        data = TestModel.objects.get(pk=1)
        resp = response.render_to_response('xslt/model-to-xml.xsl', data)
        assert(resp != HttpResponse(tree.xml(data)))

    def test_xslt_will_render_queryset(self):
        """docstring for test_xslt_will_render_queryset"""

# Path: easymode/tests/models.py
# class TestModel(models.Model):
#     "Used in lots of test"
# 
#     charfield = models.CharField(max_length=255, unique=True)
#     tags = models.ManyToManyField('TagModel', related_name='testmodels')
#     
#     def __unicode__(self):
#         return u"%s%s - %s" % (self.__class__.__name__, self.pk, self.charfield)
# 
#     def natural_key(self):
#         return (self.charfield,)
# 
# Path: easymode/utils/languagecode.py
# def get_language_codes():
#     """
#     Retrieves all the language codes defined in ``settings.LANGUAGES``.
#     
#     >>> settings.LANGUAGES = (('en','English'),('de','German'),('nl-be','Belgium dutch'),('fr-be','Belgium french'),)
#     >>> sorted( get_language_codes() )
#     ['de', 'en', 'fr-be', 'nl-be']
#     
#     :rtype: A :class:`list` of language codes.
#     """
#     return dict(settings.LANGUAGES).keys()


# Path: easymode/tests/testcases/testxslt.py
from django.http import HttpResponse
from django.template.loader import find_template_source
from django.test import TestCase
from easymode.tree import xml as tree
from easymode.tests.models import TestModel
from easymode.tests.testcases import initdb
from easymode.utils.languagecode import get_language_codes
from easymode.xslt import response

        t = TestModel(charfield='Hoi Ik ben de root node')
        t.save()
        f = t.submodels.create(subcharfield="Hoi Ik ben de first level sub node", subintegerfield=10)
        s = t.submodels.create(subcharfield="Hoi ik ben de tweede first level sub node", subintegerfield=100)
        w = t.secondsubmodels.create(ultrafield="Sed tempor. Ut felis. Maecenas erat.")
        f.subsubmodels.create(subsubcharfield="Hoi ik ben de thord level sub node")
        f.subsubmodels.create(subsubcharfield="Hoi ik ben de third level sub node")
        s.subsubmodels.create(subsubcharfield="Hoi ik ben de third level sub node")
        s.subsubmodels.create(subsubcharfield="Hoi ik ben de third level sub node")        
        t.save()
    
    def test_xsl_template_can_be_found(self):
        """docstring for test_xsl_template_can_be_found"""
        template = find_template_source('xslt/model-to-xml.xsl')
        assert(template)

    def test_xslt_template_will_render_one_object(self):
        """docstring for test_xslt_template_will_render"""
        data = TestModel.objects.get(pk=1)
        resp = response.render_to_response('xslt/model-to-xml.xsl', data)
        assert(resp)

    def test_xslt_changes_the_xml(self):
        """docstring for test_xslt_changes_the_xml"""
        data = TestModel.objects.get(pk=1)
        resp = response.render_to_response('xslt/model-to-xml.xsl', data)
        assert(resp != HttpResponse(tree.xml(data)))

    def test_xslt_will_render_queryset(self):
        """docstring for test_xslt_will_render_queryset"""

        data = TestModel.objects.all()