def test_ensure_critera_is_positive(self): """ ensure_critera_is_positive should results True for badge criteria where views are zero or positive """ b = Badge(name='test',criteria=-1) b.save() self.assertEqual((b.criteria >= 0), True)
def test_ensure_level_is_positive(self): """ ensure_level_is_positive should results True for badge level where views are zero or positive """ b = Badge(name='test',level=-1) b.save() self.assertEqual((b.level >= 0), True)
def test_ensure_achievement_has_null_default_date(self): """ ensure_achievement_has_null_default_date should results True when the default date for an achievement is null. """ b = Badge(name='test') b.save() a = Achievement(badge=b) self.assertEqual(a.date, None)
def test_BType_length_limit(self): """ BType_length_limit should ensure that an exception is thrown when a badge is created with BType length greater than eight """ try: b = Badge(name='test',BType='this_is_too_long') b.save() self.assertEqual(1, 0) except: pass