Beispiel #1
0
    def test_forum_vote_might(self):
        old_might = calculate_might(self.account)
        bill_data = PlaceRenaming(
            place_id=self.place_1.id,
            name_forms=names.generator().get_test_name('bill_place'))
        bill = BillPrototype.create(
            self.account_2,
            'caption',
            'rationale',
            bill_data,
            chronicle_on_accepted='chronicle-on-accepted')
        bill.state = BILL_STATE.REJECTED
        bill.save()

        Post.objects.all().delete()
        Thread.objects.all().delete()
        Vote.objects.all().delete()

        self.assertEqual(calculate_might(self.account_2), old_might)
        self.assertEqual(calculate_might(self.account), 0)

        VotePrototype.create(self.account, bill, VOTE_TYPE.FOR)
        self.assertTrue(calculate_might(self.account) > 0)

        Vote.objects.all().delete()
        VotePrototype.create(self.account, bill, VOTE_TYPE.AGAINST)
        self.assertTrue(calculate_might(self.account) > 0)

        Vote.objects.all().delete()
        VotePrototype.create(self.account, bill, VOTE_TYPE.REFRAINED)
        self.assertEqual(calculate_might(self.account), 0)
Beispiel #2
0
    def setUp(self):
        super(TestPrototypeApply, self).setUp()

        bill_data = PlaceRenaming(place_id=self.place1.id, name_forms=names.generator().get_test_name('new_name_1'))
        self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', bill_data, chronicle_on_accepted='chronicle-on-accepted')

        self.bill.approved_by_moderator = True
        self.bill.save()
Beispiel #3
0
    def setUp(self):
        super(TestPrototypeEnd, self).setUp()

        bill_data = PlaceRenaming(place_id=self.place1.id, name_forms=names.generator().get_test_name('new_name_1'))
        self.bill = BillPrototype.create(self.account1, 'bill-1-caption', 'bill-1-rationale', bill_data, chronicle_on_accepted='chronicle-on-accepted')

        self.bill.state = relations.BILL_STATE.ACCEPTED

        TimePrototype.get_current_time().increment_turn()
Beispiel #4
0
    def setUp(self):
        super(TestActorPrototype, self).setUp()

        self.bill_data = PlaceRenaming(
            place_id=self.place1.id,
            name_forms=names.generator().get_test_name('new_name_1'))
        self.bill = BillPrototype.create(
            self.account1,
            'bill-1-caption',
            self.bill_data,
            chronicle_on_accepted='chronicle-on-accepted')
Beispiel #5
0
 def create_bill(self, account=None):
     if account is None:
         account = self.account1
     bill_data = PlaceRenaming(
         place_id=self.place1.id,
         name_forms=names.generator.get_test_name('new_name_1'))
     return BillPrototype.create(
         account,
         'bill-1-caption',
         'bill-1-rationale',
         bill_data,
         chronicle_on_accepted='chronicle-on-accepted')
Beispiel #6
0
    def test_voted_bill_might(self):
        old_might = calculate_might(self.account)
        bill_data = PlaceRenaming(place_id=self.place_1.id, name_forms=names.generator.get_test_name('bill_place'))
        bill = BillPrototype.create(self.account, 'caption', 'rationale', bill_data, chronicle_on_accepted='chronicle-on-accepted')
        bill.state = BILL_STATE.VOTING
        bill.save()

        Post.objects.all().delete()
        Thread.objects.all().delete()
        Vote.objects.all().delete()

        self.assertEqual(calculate_might(self.account), old_might)
        self.assertEqual(calculate_might(self.account_2), 0)
Beispiel #7
0
    def create_bill(self, index, owner, state):
        from the_tale.game.bills.bills import PlaceRenaming
        from the_tale.game.bills.prototypes import BillPrototype

        bill_data = PlaceRenaming(place_id=self.place1.id,
                                  name_forms=names.generator().get_test_name(
                                      'new_name_%d' % index))
        bill = BillPrototype.create(
            owner,
            'bill-%d-caption' % index,
            bill_data,
            chronicle_on_accepted='chronicle-on-accepted')
        bill.state = state
        bill.save()
 def create_place_renaming_bill(self, index):
     self.bill_data = PlaceRenaming(place_id=self.place1.id, name_forms=names.generator.get_test_name('new_name_%d' % index))
     return BillPrototype.create(self.account1, 'bill-%d-caption' % index, 'bill-%d-rationale' % index, self.bill_data, chronicle_on_accepted='chronicle-on-accepted')