Added basic test case

--HG--
branch : pmitros-mod-template
This commit is contained in:
Piotr Mitros
2012-02-11 09:31:03 -05:00
parent cbc020785a
commit b274c2e26c
2 changed files with 20 additions and 13 deletions

View File

@@ -34,5 +34,16 @@ for module in modx_module_list:
modx_modules[tag] = module.Module
def get_module_class(tag):
''' Given an XML tag (e.g. 'video'), return
the associated module (e.g. video_module.Module).
'''
return modx_modules[tag]
def get_module_id(tag):
''' Given an XML tag (e.g. 'video'), return
the default ID for that module (e.g. 'youtube_id')
'''
return modx_modules[tag].id_attribute
def get_valid_tags():
return modx_modules.keys()

View File

@@ -1,16 +1,12 @@
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
import unittest
import courseware.modules
Replace this with more appropriate tests for your application.
"""
class ModelsTest(unittest.TestCase):
def setUp(self):
pass
from django.test import TestCase
def test_get_module_class(self):
vc = courseware.modules.get_module_class('video')
vc_str = "<class 'courseware.modules.video_module.Module'>"
self.assertEqual(str(vc), vc_str)
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)