def test_has_meaning__duplicate_description(self): VotePrototype.create(self.account2, self.bill, False) VotePrototype.create(self.account3, self.bill, True) form = PlaceDescripton.ModeratorForm({'approved': True}) self.assertTrue(form.is_valid()) self.bill.update_by_moderator(form) self.place.description = 'new description' self.place.save() self.assertFalse(self.bill.has_meaning())
def test_user_form_validation__wrong_bill(self): bill_data = PlaceDescripton(place_id=self.place1.id, description='new description') bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', bill_data, chronicle_on_accepted='chronicle-on-accepted',) form = PlaceDescripton.ModeratorForm({'approved': True}) self.assertTrue(form.is_valid()) bill.update_by_moderator(form) self.assertTrue(bill.apply()) form = self.bill.data.get_user_form_update(post={'caption': 'caption', 'rationale': 'rationale', 'chronicle_on_accepted': 'chronicle-on-accepted-3', 'declined_bill': bill.id}) self.assertFalse(form.is_valid())
def test_apply(self): VotePrototype.create(self.account2, self.bill, False) VotePrototype.create(self.account3, self.bill, True) form = PlaceDescripton.ModeratorForm({'approved': True}) self.assertTrue(form.is_valid()) self.bill.update_by_moderator(form) self.assertTrue(self.bill.apply()) bill = BillPrototype.get_by_id(self.bill.id) self.assertTrue(bill.state.is_ACCEPTED) self.assertNotEqual(self.place.description, 'old description') self.assertEqual(self.place.description, 'new description')