With native tags, the templatetag is simply just a function you define which means that testing the underlying functionality of your templatetag does not require going to your browser. Just pass in the appropriate arguments and test the output. Here is an example of unittesting a native tag which demonstrates how trivial it can be:
# tests.py
from django.test import TestCase
from native_tags import function
# Define or import your tags here
@function
def adder(x, y):
return x + y
class AdderTest(TestCase):
def test_adder(self):
self.assertEqual(adder(1, 1), 2)
That is the full example above, but to add simple tests to a native function, you can use the test attribute passing in the arguments and expected result of the function call. Here is a shorter example that does the same thing as above:
def adder(x, y):
return x + y
adder = function(adder, test={'args': (1, 1), 'result': 2})
Running ./manage.py test native_tags will test the native_tag core as well as any of your own test tags as defined like the above example.