def setUp(self): super(BillPlaceChangeModifierTests, self).setUp() bill_data = bills.PlaceModifier(place_id=self.place1.id, modifier_id=TradeCenter.get_id(), modifier_name=TradeCenter.TYPE.text, old_modifier_name=None) self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', bill_data, chronicle_on_accepted='chronicle-on-accepted') self.form = bills.PlaceModifier.ModeratorForm({'approved': True}) self.assertTrue(self.form.is_valid())
def setUp(self): super(PlaceModifierTests, self).setUp() self.place = self.place1 self.place_2 = self.place2 self.bill_data = PlaceModifier(place_id=self.place.id, modifier_id=TradeCenter.get_id(), modifier_name=TradeCenter.TYPE.text, old_modifier_name=None) self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')
def test_place_info_modifier(self): self.place_1.modifier = TradeCenter(self.place_1) self.place_1.save() texts = [('pgf-current-modifier-marker', 1)] self.check_html_ok(self.request_html( reverse('game:map:cell-info') + ('?x=%d&y=%d' % (self.place_1.x, self.place_1.y))), texts=texts)
def test_apply(self): VotePrototype.create(self.account2, self.bill, False) VotePrototype.create(self.account3, self.bill, True) form = PlaceModifier.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.modifier, None) self.assertEqual(self.place.modifier, TradeCenter(self.place))
def setUp(self): super(PlaceModifierTests, self).setUp() self.place = self.place1 self.place_2 = self.place2 self.bill_data = PlaceModifier(place_id=self.place.id, modifier_id=TradeCenter.get_id(), modifier_name=TradeCenter.TYPE.text, old_modifier_name=None) self.bill = BillPrototype.create( self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')
def test_create(self): self.assertEqual(self.bill.data.place_id, self.place.id) self.assertEqual(self.bill.data.modifier_id, TradeCenter.get_id()) self.assertEqual(self.bill.data.modifier_name, TradeCenter.TYPE.text) self.assertEqual(self.bill.data.old_modifier_name, None)