def test_can_read_now(self): profile = ProfileFactory() profile.is_active = True profile.can_read = True self.assertTrue(profile.can_read_now()) # Was banned in the past, ban no longer active profile = ProfileFactory() profile.end_ban_read = datetime.now() - timedelta(days=1) self.assertTrue(profile.can_read_now()) profile = ProfileFactory() profile.is_active = True profile.can_read = False self.assertFalse(profile.can_read_now()) # Ban is active profile = ProfileFactory() profile.is_active = True profile.can_read = False profile.end_ban_read = datetime.now() + timedelta(days=1) self.assertFalse(profile.can_read_now()) self.user1.user.is_active = False self.assertFalse(self.user1.can_read_now())