def test_chance_4_5_owned(self):
        dice = utils.Dice()
        dice.roll = MagicMock(return_value=(1, 2))
        special_property_phase = SpecialProperty(dice)
        bsmt_phase = BSMT()
        phases = {
            'SpecialProperty': special_property_phase,
            'BSMT': bsmt_phase
        }
        board = Board()
        board.next_chance = MagicMock(return_value=4)
        reading_railroad = board.property_at(5)
        board.nearest_railroad = MagicMock(return_value=reading_railroad)
        player_1 = Player(1, amount=100, position=board.property_at(0))
        player_2 = Player(2, amount=300, position=board.property_at(36))
        players = [player_1, player_2]
        game_state = GameState(players, board)
        game_state.next_player()
        game_phase = special_property_phase
        context = Context(phases, game_state, game_phase)
        reading_railroad.own(player_1)
        reading_railroad.rent = MagicMock(return_value=15)

        new_context, next_action = context.apply()

        self.assertTrue(new_context.phase is bsmt_phase)
        self.assertTrue(player_2.position is reading_railroad)
        self.assertEqual(player_2.amount, 300 - 10 * 15)
        self.assertEqual(player_1.amount, 100 + 10 * 15)
    def test_chance_4_5_unowned(self):
        special_property_phase = SpecialProperty()
        buy_property_phase = BuyProperty()
        phases = {
            'SpecialProperty': special_property_phase,
            'BuyProperty': buy_property_phase
        }
        board = Board()
        board.next_chance = MagicMock(return_value=4)
        reading_railroad = board.property_at(5)
        board.nearest_railroad = MagicMock(return_value=reading_railroad)
        player_1 = Player(1, amount=100, position=board.property_at(0))
        player_2 = Player(2, amount=300, position=board.property_at(36))
        players = [player_1, player_2]
        game_state = GameState(players, board)
        game_state.next_player()
        game_phase = special_property_phase
        context = Context(phases, game_state, game_phase)

        new_context, next_action = context.apply()

        self.assertTrue(new_context.phase is buy_property_phase)
        self.assertTrue(player_2.position is reading_railroad)
        self.assertEqual(player_2.amount, 300)
        self.assertEqual(player_1.amount, 100)