예제 #1
0
        def test_call_close_from_tick(self, mock_close_from_tick):
            epic = EpicFactory()
            trade = TradeFactory(epic=epic)

            last_tick = TickFactory()
            epic.last_tick = last_tick

            trade.close_from_epic()

            assert mock_close_from_tick.call_args_list == [call(last_tick)]
예제 #2
0
        def test_return(self, mocker):
            mocker.patch(
                f"{CLASS_TRADE_DEFINITION_PATH}.close_from_tick",
                return_value="test_close",
            )
            trade = TradeFactory(epic=EpicFactory())

            result = trade.close_from_epic()

            assert result == "test_close"