def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://localhost:{0}/api.test'.format(self.server.port)) rate = perform_request("EUR", request=req.clone()) self.assertIsInstance(rate, float) self.assertEqual(0.85, rate)
def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://localhost:{0}/api.test'.format( self.server.port)) estimate = perform_request("BTC", "ETH", 1.0, request=req.clone()) self.assertIsInstance(estimate, float) self.assertEqual(5.0, estimate)
def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://localhost:{0}/api.test'.format( self.server.port)) value = perform_request("BTC", request=req.clone()) self.assertIsInstance(value, float) self.assertEqual(100.0, value)
def test_perform_request_with_config_without_user_id(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) wallet = perform_request("BTC", config=get_config("tgda2"), request=req.clone()) self.assertIsInstance(wallet, basestring) self.assertEqual("wallet-bitcoin", wallet)
def test_perform_request_with_config(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) wallet = perform_request("ETH", config="tgda", request=req.clone()) self.assertIsInstance(wallet, basestring) self.assertEqual("wallet-ethereum", wallet)
def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) wallet = perform_request("BTC", request=req.clone()) self.assertIsInstance(wallet, basestring) self.assertEqual("bitcoin-wallet", wallet)
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_with_config_without_user_id(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) estimates = perform_request(config=get_config("tgme2"), request=req.clone()) self.assertIsInstance(estimates, dict) self.assertIn("MiningSHA-256", estimates.keys()) self.assertIsInstance(estimates["MiningSHA-256"], float) self.assertEqual((1.0/12.0), estimates["MiningSHA-256"])
def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) estimates = perform_request(request=req.clone()) self.assertIsInstance(estimates, dict) self.assertIn("MiningSHA-256", estimates.keys()) self.assertIsInstance(estimates["MiningSHA-256"], float) self.assertEqual((1.0/6.0), estimates["MiningSHA-256"])
def test_perform_request_with_config_without_user_id(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) mode = perform_request(config=get_config("tgmm2"), request=req.clone()) self.assertIsInstance(mode, basestring) self.assertEqual("ETH", mode)
def test_perform_request_with_config(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) user_id = perform_request(config="tgui3", request=req.clone()) self.assertIsInstance(user_id, int) self.assertEqual(456, user_id)
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(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) result = perform_request("BTC", 0.1, "bitcoin-wallet", request=req.clone()) self.assertTrue(result)
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("BTC", 0.05, "wallet-bitcoin", config="tsaw2", request=req.clone()) self.assertTrue(result)
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(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(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://*****:*****@example.com", password="******", token=None) speeds = perform_request(config="tgms", request=req.clone()) self.assertIsInstance(speeds, dict) self.assertIn("MiningSHA-256", speeds.keys()) self.assertIsInstance(speeds["MiningSHA-256"], float) self.assertEqual(5.0, speeds["MiningSHA-256"])
def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://localhost:{0}/api.test'.format( self.server.port)) coins = perform_request(request=req.clone()) self.assertIsInstance(coins, dict) self.assertIn("BTC", coins.keys()) self.assertIn("ETH", coins.keys()) self.assertIsInstance(coins["BTC"], dict) self.assertIsInstance(coins["ETH"], dict) self.assertIn("Price", coins["BTC"].keys()) self.assertIn("Image", coins["BTC"].keys()) self.assertIn("BigImage", coins["BTC"].keys()) self.assertIn("Price", coins["ETH"].keys()) self.assertIn("Image", coins["ETH"].keys()) self.assertIn("BigImage", coins["ETH"].keys()) self.assertIsInstance(coins["BTC"]["Price"], float) self.assertIsInstance(coins["BTC"]["Image"], basestring) self.assertIsInstance(coins["BTC"]["BigImage"], basestring) self.assertIsInstance(coins["ETH"]["Price"], float) self.assertIsInstance(coins["ETH"]["Image"], basestring) self.assertIsInstance(coins["ETH"]["BigImage"], basestring) self.assertEqual(100.0, coins["BTC"]["Price"]) self.assertEqual("http://www.eobot.com/btc.png", coins["BTC"]["Image"]) self.assertEqual("http://www.eobot.com/btcbig.png", coins["BTC"]["BigImage"]) self.assertEqual(20.0, coins["ETH"]["Price"]) self.assertEqual("http://www.eobot.com/eth.png", coins["ETH"]["Image"]) self.assertEqual("http://www.eobot.com/ethbig.png", coins["ETH"]["BigImage"])
def test_perform_request(self): MockServer.reset() req = EobotRequest() req.set_base_url('http://localhost:{0}/api.test'.format( self.server.port)) fiat = perform_request(request=req.clone()) self.assertIsInstance(fiat, dict) self.assertIn("USD", fiat.keys()) self.assertIn("EUR", fiat.keys()) self.assertIsInstance(fiat["USD"], dict) self.assertIsInstance(fiat["EUR"], dict) self.assertIn("Price", fiat["USD"].keys()) self.assertIn("Price", fiat["EUR"].keys()) self.assertIsInstance(fiat["USD"]["Price"], float) self.assertIsInstance(fiat["EUR"]["Price"], float) self.assertEqual(1.0, fiat["USD"]["Price"]) self.assertEqual(0.85, fiat["EUR"]["Price"])