Beispiel #1
0
class TaskTest(EngineTestCase):
	def setUp(self):
		super(TaskTest, self).setUp()

		self.c_corporation_market = self.c.get_random_corporation_market()
		self.c2_corporation_market = self.c2.get_random_corporation_market()

		self.v = VoteOrder(
			player=self.p,
			corporation_market_up=self.c_corporation_market,
			corporation_market_down=self.c2_corporation_market,
		)
		self.v.save()

	def test_vote(self):
		begin_assets_1 = self.c.assets
		begin_assets_2 = self.c2.assets

		self.g.resolve_current_turn()

		self.c = self.reload(self.c)
		self.c2 = self.reload(self.c2)

		self.assertEqual(self.c.assets, begin_assets_1 + 1)
		self.assertEqual(self.c2.assets, begin_assets_2 - 1)
Beispiel #2
0
    def test_cant_vote_more_than_once(self):
        o = VoteOrder(corporation_up=self.c,
                      corporation_down=self.c2,
                      player=self.p)
        # assertNoRaises
        o.save()

        o2 = VoteOrder(corporation_up=self.c,
                       corporation_down=self.c2,
                       player=self.p)

        self.assertRaises(OrderNotAvailable, o2.clean)
Beispiel #3
0
    def test_corporation_up_and_down(self):

        begin_assets_1 = self.c.assets
        begin_assets_2 = self.c2.assets
        o = VoteOrder(corporation_up=self.c,
                      corporation_down=self.c2,
                      player=self.p)
        o.save()

        o.resolve()

        self.assertEqual(self.reload(self.c).assets, begin_assets_1 + 1)
        self.assertEqual(self.reload(self.c2).assets, begin_assets_2 - 1)
Beispiel #4
0
	def test_corporation_up_and_down(self):

		begin_assets_1 = self.c.assets
		begin_assets_2 = self.c2.assets
		o = VoteOrder(
			corporation_market_up=self.c_corporation_market,
			corporation_market_down=self.c2_corporation_market,
			player=self.p
		)
		o.save()

		o.resolve()

		self.assertEqual(self.reload(self.c).assets, begin_assets_1 + 1)
		self.assertEqual(self.reload(self.c2).assets, begin_assets_2 - 1)
Beispiel #5
0
	def test_cant_vote_more_than_once(self):
		o = VoteOrder(
			corporation_market_up=self.c_corporation_market,
			corporation_market_down=self.c2_corporation_market,
			player=self.p
		)
		# assertNoRaises
		o.save()

		o2 = VoteOrder(
			corporation_market_up=self.c_corporation_market,
			corporation_market_down=self.c2_corporation_market,
			player=self.p
		)

		self.assertRaises(OrderNotAvailable, o2.clean)
Beispiel #6
0
class TaskTest(EngineTestCase):
    def setUp(self):
        super(TaskTest, self).setUp()

        self.v = VoteOrder(player=self.p,
                           corporation_up=self.c,
                           corporation_down=self.c2)
        self.v.save()

    def test_vote(self):
        begin_assets_1 = self.c.assets
        begin_assets_2 = self.c2.assets

        self.g.resolve_current_turn()

        self.c = self.reload(self.c)
        self.c2 = self.reload(self.c2)

        self.assertEqual(self.c.assets, begin_assets_1 + 1)
        self.assertEqual(self.c2.assets, begin_assets_2 - 1)