コード例 #1
0
    def test_upsert_order(self):
        test_inst = ExchangePersonalData()

        # without orders
        test_inst.orders = {}
        assert not test_inst.has_order(10)
        test_inst.upsert_order(10, None)
        assert test_inst.has_order(10)
コード例 #2
0
    def test_has_order(self):
        test_inst = ExchangePersonalData()

        # without orders
        test_inst.orders = {}
        assert not test_inst.has_order(10)
        test_inst.orders[10] = self.create_fake_order(10, None, None, None)
        assert test_inst.has_order(10)
        assert not test_inst.has_order(153)
コード例 #3
0
    def test_set_orders(self):
        test_inst = ExchangePersonalData()

        # without orders
        test_inst.orders = {}
        assert not test_inst.has_order(10)
        assert not test_inst.has_order(20)
        test_inst.upsert_orders([{
            "id": 15
        }, {
            "id": 10
        }, {
            "id": 20
        }, {
            "id": 15
        }])
        assert test_inst.get_order(15)
        assert test_inst.has_order(15)
        assert test_inst.has_order(20)
        assert test_inst.has_order(10)
        assert not test_inst.has_order(12)
        assert not test_inst.has_order(30)