示例#1
0
 def test_exchange_config_no_bid_ratio(self):
     bad_config = self.exchange_test_data()
     del bad_config['test_exchange']['btc']['bid']['ratio']
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], 'There is no ratio set for test_exchange.btc.bid')
示例#2
0
 def test_exchange_config_negative_bid_ratio(self):
     bad_config = self.exchange_test_data()
     bad_config['test_exchange']['btc']['bid']['ratio'] = -1234
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], 'The ratio set for test_exchange.btc.bid is incorrect')
示例#3
0
 def test_exchange_config_no_bid(self):
     bad_config = self.exchange_test_data()
     del bad_config['test_exchange']['btc']['bid']
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], "test_exchange.btc has no 'bid' details")
示例#4
0
 def test_exchange_config_zero_ask_ratio(self):
     bad_config = self.exchange_test_data()
     bad_config['test_exchange']['btc']['ask']['ratio'] = 0
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], 'The ratio set for test_exchange.btc.ask is incorrect')
示例#5
0
 def test_exchange_no_reverse_param(self):
     bad_config = self.exchange_test_data()
     del bad_config['test_exchange']['btc']['reverse']
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], 'There is no reverse parameter for test_exchange.btc')
示例#6
0
 def test_exchange_config_zero_target(self):
     bad_config = self.exchange_test_data()
     bad_config['test_exchange']['btc']['target'] = 0
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], 'The target set for test_exchange.btc is incorrect')
示例#7
0
 def test_exchange_no_target(self):
     bad_config = self.exchange_test_data()
     del bad_config['test_exchange']['btc']['target']
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], 'There is no target set for test_exchange.btc')
示例#8
0
 def test_exchange_config_incorrect_exchange(self):
     ex_config = self.exchange_test_data()
     bad_config = {'bad_exchange': ex_config['test_exchange']}
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], 'bad_exchange is not a supported exchange')
示例#9
0
 def test_exchange_config_ask_bid_ratio(self):
     bad_config = self.exchange_test_data()
     bad_config['test_exchange']['btc']['ask']['ratio'] = 0.6
     bad_config['test_exchange']['btc']['bid']['ratio'] = 0.6
     self.build_exchange_config_file(json.dumps(bad_config))
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], "The ask and bid ratios don't add up to 1.0")
示例#10
0
 def test_exchange_config_full(self):
     full_config = self.exchange_test_data()
     self.build_exchange_config_file(json.dumps(full_config))
     check = config.check_exchange_config('test_exchange_config')
     print check
     self.assertTrue(check[0])
示例#11
0
 def test_exchange_config_invalid_json(self):
     self.build_exchange_config_file('{"test": 1234, }')
     check = config.check_exchange_config('test_exchange_config')
     self.assertFalse(check[0])
     self.assertEqual(check[1], 'test_exchange_config is not valid json')
     return