add some unit tests for the new fields

This commit is contained in:
Chris Dodge
2013-07-31 15:53:04 -04:00
parent 0937cdcbe6
commit ebbeeb16a2
2 changed files with 12 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ def get_dummy_course(start, announcement=None, is_new=None, advertised_start=Non
end = to_attrb('end', end)
start_xml = '''
<course org="{org}" course="{course}"
<course org="{org}" course="{course}" display_organization="{org}_display" display_coursenumber="{course}_display"
graceperiod="1 day" url_name="test"
start="{start}"
{announcement}
@@ -141,6 +141,16 @@ class IsNewCourseTestCase(unittest.TestCase):
print "Checking start=%s advertised=%s" % (s[0], s[1])
self.assertEqual(d.start_date_text, s[2])
def test_display_organization(self):
descriptor = get_dummy_course(start='2012-12-02T12:00', is_new=True)
self.assertNotEqual(descriptor.location.org, descriptor.display_org_with_default)
self.assertEqual(descriptor.display_org_with_default, "{0}_display".format(ORG))
def test_display_coursenumber(self):
descriptor = get_dummy_course(start='2012-12-02T12:00', is_new=True)
self.assertNotEqual(descriptor.location.course, descriptor.display_number_with_default)
self.assertEqual(descriptor.display_number_with_default, "{0}_display".format(COURSE))
def test_is_newish(self):
descriptor = get_dummy_course(start='2012-12-02T12:00', is_new=True)
assert(descriptor.is_newish is True)

View File

@@ -1 +1 @@
<course org="edX" course="toy" url_name="2012_Fall"/>
<course org="edX" course="toy" url_name="2012_Fall" display_organization="edX_display" display_coursenum="2012_Fall_Display" />