def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) balances = perform_request(request=req.clone()) self.assertIsInstance(balances, dict) self.assertEqual(3, len(balances)) self.assertIn("BTC", balances.keys()) self.assertIn("ETH", balances.keys()) self.assertIn("Total", balances.keys()) self.assertEqual(0.2, balances["BTC"]) self.assertEqual(2.5, balances["ETH"]) self.assertEqual(70.0, balances["Total"])
def test_perform_request_with_config_without_user_id(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) balances = perform_request(config=get_config("tgb2"), request=req.clone()) self.assertIsInstance(balances, dict) self.assertEqual(3, len(balances)) self.assertIn("BTC", balances.keys()) self.assertIn("ETH", balances.keys()) self.assertIn("Total", balances.keys()) self.assertEqual(0.1, balances["BTC"]) self.assertEqual(2.0, balances["ETH"]) self.assertEqual(50.0, balances["Total"])
def test_perform_request_with_invalid_request(self): with self.assertRaises(ValueError): # noinspection PyTypeChecker perform_request(request={})