def test_fail_with_additional_properties(self): def wrong_monkey(): return Monkey(name="bonzo", collar="leather") def collar_monkey(monkey): monkey.collar = "leather" self.assertRaises(FamValidationError, wrong_monkey) monkey = Monkey(name="bonzo") self.assertRaises(FamValidationError, collar_monkey, monkey)
def test_update_works_without_rev(self): monkey = Monkey(name="fly") monkey.save(self.db) monkey.rev = None monkey.name = "jess" self.db.put(monkey)
def wrong_monkey(): return Monkey(name="bonzo", collar="leather")
def test_immutable_saving(self): monkey = Monkey(key="red_monkey", colour="red") self.db.put(monkey) monkey = Monkey(key="red_monkey", colour="blue") self.assertRaises(FamImmutableError, self.db.put, monkey)