コード例 #1
0
    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"])
コード例 #2
0
    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"])
コード例 #3
0
    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)
コード例 #4
0
    def test_perform_request_with_config(self):
        req = EobotRequest()
        req.set_base_url('http://*****:*****@example.com",
                                     password="******",
                                     token=None)

        mode_before = get_mining_mode(config="tsmm", request=req.clone())
        self.assertEqual("ETH", mode_before)

        result = perform_request("BTC", config="tsmm", request=req.clone())
        self.assertTrue(result)

        mode_after = get_mining_mode(config="tsmm", request=req.clone())
        self.assertEqual("BTC", mode_after)
コード例 #5
0
    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)
コード例 #6
0
    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)
コード例 #7
0
    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)
コード例 #8
0
    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)
コード例 #9
0
    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)
コード例 #10
0
    def test_perform_request_with_config_without_user_id(self):
        req = EobotRequest()
        req.set_base_url('http://*****:*****@example.com",
                                      password="******",
                                      token=None)

        result = perform_request("BTC",
                                 config=get_config("tsmm2"),
                                 request=req.clone())
        self.assertTrue(result)
コード例 #11
0
    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)
コード例 #12
0
    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"])
コード例 #13
0
    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"])
コード例 #14
0
    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)
コード例 #15
0
    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)
コード例 #16
0
    def test_perform_request_with_config(self):
        MockServer.reset()
        req = EobotRequest()
        req.set_base_url('http://*****:*****@example.com",
                                     password="******",
                                     token=None)

        result = perform_request("BTC",
                                 0.05,
                                 "wallet-bitcoin",
                                 config="tsaw",
                                 request=req.clone())
        self.assertTrue(result)
コード例 #17
0
    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"])
コード例 #18
0
    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"])
コード例 #19
0
    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"])
コード例 #20
0
    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"])
コード例 #21
0
    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"])