def test_perform_request_with_config_without_user_id(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) result = perform_request("ETH", 0.5, "BTC", config="tec2", request=req.clone()) self.assertTrue(result) self.assertEqual(0.2, get_balances(config=get_config("tec2"), request=req.clone())["BTC"]) self.assertEqual(1.5, get_balances(config=get_config("tec2"), request=req.clone())["ETH"])
def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) self.assertEqual(0.2, get_balances(request=req.clone())["BTC"]) self.assertEqual(2.5, get_balances(request=req.clone())["ETH"]) result = perform_request("BTC", 0.1, "ETH", request=req.clone()) self.assertTrue(result) self.assertEqual(0.1, get_balances(request=req.clone())["BTC"]) self.assertEqual(3.0, get_balances(request=req.clone())["ETH"])
def test_perform_request_with_invalid_from_coin(self): with self.assertRaises(ValueError): # noinspection PyTypeChecker perform_request(123, 1, "ETH")
def test_perform_request_with_invalid_request(self): with self.assertRaises(ValueError): # noinspection PyTypeChecker perform_request("BTC", 1, "ETH", request={})
def test_perform_request_without_arguments(self): with self.assertRaises(TypeError): # noinspection PyArgumentList perform_request()