def testCampusSlugStartsWithUC(self): c = Campus() c.name = "test" c.slug = "test" self.assertRaises(ValueError, c.save) c.slug = "UCtest" c.save() self.assertTrue(hasattr(c, "ark")) self.assertTrue(hasattr(c, "google_analytics_tracking_code"))
def testNoDupArks(self): """Need to programatically check that the arks are unique. Due to the need for blank arks (django weird char null), we can't use the DB unique property. """ c = Campus() c.name = "test" c.slug = "UCtest" c.ark = "ark:/13030/tf0p3009mq" self.assertRaises(ValueError, c.save) try: c.save() except ValueError, e: self.assertEqual(e.args, ("Campus with ark ark:/13030/tf0p3009mq already exists",))