本文整理汇总了Python中the_tale.game.bills.prototypes.BillPrototype.create方法的典型用法代码示例。如果您正苦于以下问题:Python BillPrototype.create方法的具体用法?Python BillPrototype.create怎么用?Python BillPrototype.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.game.bills.prototypes.BillPrototype
的用法示例。
在下文中一共展示了BillPrototype.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(BillDeclineResourceExchangeTests, self).setUp()
self.resource_1, self.resource_2 = choose_exchange_resources()
self.declined_bill_data = PlaceResourceExchange(
place_1_id=self.place1.id, place_2_id=self.place2.id, resource_1=self.resource_1, resource_2=self.resource_2
)
self.declined_bill = BillPrototype.create(
owner=self.account1,
caption="declined-bill-caption",
rationale="declined-bill-rationale",
chronicle_on_accepted="chronicle-on-accepted",
bill=self.declined_bill_data,
)
data = self.declined_bill.user_form_initials
data["approved"] = True
declined_form = self.declined_bill.data.get_moderator_form_update(data)
self.assertTrue(declined_form.is_valid())
self.declined_bill.update_by_moderator(declined_form)
self.declined_bill.apply()
self.bill_data = BillDecline(declined_bill_id=self.declined_bill.id)
self.bill = BillPrototype.create(
self.account1,
"bill-caption",
"bill-rationale",
self.bill_data,
chronicle_on_accepted="chronicle-on-accepted",
)
示例2: create_bill_decline__exchange
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def create_bill_decline__exchange(self):
resource_1, resource_2 = choose_exchange_resources()
declined_bill_data = bills.PlaceResourceExchange(
place_1_id=self.place_1.id, place_2_id=self.place_2.id, resource_1=resource_1, resource_2=resource_2
)
declined_bill = BillPrototype.create(
self.account,
"declined-bill-caption",
"declined-bill-rationale",
declined_bill_data,
chronicle_on_accepted="chronicle-on-accepted",
)
declined_form = bills.PlaceResourceExchange.ModeratorForm({"approved": True})
self.assertTrue(declined_form.is_valid())
declined_bill.update_by_moderator(declined_form)
declined_bill.apply()
bill_data = bills.BillDecline(declined_bill_id=declined_bill.id)
bill = BillPrototype.create(
self.account, "bill-caption", "bill-rationale", bill_data, chronicle_on_accepted="chronicle-on-accepted"
)
return bill, declined_bill
示例3: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(GetApplicableBillsTest, self).setUp()
self.bill_data = PlaceDescripton(place_id=self.place1.id, description='description')
self.bill_1 = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')
self.bill_2 = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')
self.bill_3 = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')
BillPrototype._model_class.objects.all().update(updated_at=datetime.datetime.now() - datetime.timedelta(seconds=bills_settings.BILL_LIVE_TIME),
approved_by_moderator=True)
self.bill_1.reload()
self.bill_2.reload()
self.bill_3.reload()
示例4: test_update
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def test_update(self):
declined_bill_2 = BillPrototype.create(
self.account1,
"declined-bill-caption",
"declined-bill-rationale",
self.declined_bill_data,
chronicle_on_accepted="chronicle-on-accepted-2",
)
data = declined_bill_2.user_form_initials
data["approved"] = True
declined_form = declined_bill_2.data.get_moderator_form_update(data)
self.assertTrue(declined_form.is_valid())
declined_bill_2.update_by_moderator(declined_form)
declined_bill_2.apply()
form = self.bill.data.get_user_form_update(
post={
"caption": "new-caption",
"rationale": "new-rationale",
"chronicle_on_accepted": "chronicle-on-accepted-3",
"declined_bill": declined_bill_2.id,
}
)
self.assertTrue(form.is_valid())
self.bill.update(form)
self.bill = BillPrototype.get_by_id(self.bill.id)
self.assertEqual(self.bill.data.declined_bill_id, declined_bill_2.id)
示例5: test_user_form_validation__wrong_bill
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
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",
)
data = bill.user_form_initials
data["approved"] = True
form = bill.data.get_moderator_form_update(data)
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())
示例6: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(PersonRemoveSocialConnectionTests, self).setUp()
self.person_1_1 = self.place1.persons[0]
self.person_2_1, self.person_2_2 = self.place2.persons[0:2]
self.person_3_1 = self.place3.persons[0]
self.account = self.accounts_factory.create_account()
persons_logic.create_social_connection(
connection_type=persons_relations.SOCIAL_CONNECTION_TYPE.PARTNER,
person_1=self.person_1_1,
person_2=self.person_2_1,
)
self.bill_data = PersonRemoveSocialConnection(person_1_id=self.person_1_1.id, person_2_id=self.person_2_1.id)
self.bill = BillPrototype.create(
self.account1,
"bill-1-caption",
"bill-1-rationale",
self.bill_data,
chronicle_on_accepted="chronicle-on-accepted",
)
self.person_1_1.politic_power.change_power(
self.person_1_1, hero_id=self.account.id, has_in_preferences=True, power=100
)
示例7: create_bill_decline__conversion
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def create_bill_decline__conversion(self):
conversion_1, conversion_2 = choose_conversions()
declined_bill_data = bills.PlaceResourceConversion(place_id=self.place_1.id,
conversion=conversion_1)
declined_bill = BillPrototype.create(self.account, 'declined-bill-caption', 'declined-bill-rationale', declined_bill_data, chronicle_on_accepted='chronicle-on-accepted')
declined_form = bills.PlaceResourceConversion.ModeratorForm({'approved': True})
self.assertTrue(declined_form.is_valid())
declined_bill.update_by_moderator(declined_form)
declined_bill.apply()
bill_data = bills.BillDecline(declined_bill_id=declined_bill.id)
bill = BillPrototype.create(self.account, 'bill-caption', 'bill-rationale', bill_data, chronicle_on_accepted='chronicle-on-accepted')
return bill, declined_bill
示例8: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(BillPlaceDescriptionTests, self).setUp()
bill_data = bills.PlaceDescripton(place_id=self.place1.id, description='new description')
self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', bill_data, chronicle_on_accepted='chronicle-on-accepted')
self.form = bills.PlaceDescripton.ModeratorForm({'approved': True})
self.assertTrue(self.form.is_valid())
示例9: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(PersonChronicleTests, self).setUp()
self.person1 = sorted(self.place1.persons, key=lambda p: -p.power)[0]
self.person2 = sorted(self.place2.persons, key=lambda p: -p.power)[-1]
self.bill_data = PersonChronicle(person_id=self.person1.id, old_place_name_forms=self.place1.utg_name, power_bonus=relations.POWER_BONUS_CHANGES.UP)
self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')
示例10: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(BuildingCreateTests, self).setUp()
self.person_1 = sorted(self.place1.persons, key=lambda p: -p.power)[0]
self.person_2 = sorted(self.place2.persons, key=lambda p: -p.power)[-1]
self.bill_data = BuildingCreate(person_id=self.person_1.id, old_place_name_forms=self.place1.utg_name, utg_name=names.generator.get_test_name(u'building-name'))
self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')
示例11: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
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')
示例12: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(PlaceDescriptionTests, self).setUp()
self.place = places_storage.all()[0]
self.place.description = 'old description'
self.place.save()
self.place_2 = places_storage.all()[1]
self.bill_data = PlaceDescripton(place_id=self.place.id, description='new description')
self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')
示例13: test_decline__success
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def test_decline__success(self):
self.apply_bill()
old_storage_version = places_storage.resource_exchanges._version
decliner = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted-2')
self.bill.decline(decliner)
self.assertNotEqual(old_storage_version, places_storage.resource_exchanges._version)
self.assertEqual(len(places_storage.resource_exchanges.all()), 0)
示例14: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(PlaceResourceExchangeTests, self).setUp()
self.resource_1, self.resource_2 = choose_exchange_resources()
self.bill_data = PlaceResourceExchange(place_1_id=self.place1.id,
place_2_id=self.place2.id,
resource_1=self.resource_1,
resource_2=self.resource_2)
self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data,
chronicle_on_accepted='chronicle-on-accepted')
示例15: setUp
# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import create [as 别名]
def setUp(self):
super(PersonMoveTests, self).setUp()
self.person_1, self.person_2, self.person_3 = self.place1.persons[0:3]
self.account = self.accounts_factory.create_account()
self.person_1.politic_power.change_power(self.person_1, hero_id=self.account.id, has_in_preferences=True, power=100)
self.person_2.politic_power.change_power(self.person_2, hero_id=self.account.id, has_in_preferences=True, power=200)
self.bill_data = PersonMove(person_id=self.person_1.id, new_place_id=self.place2.id)
self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', self.bill_data, chronicle_on_accepted='chronicle-on-accepted')