-
-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from s4w3d0ff/dev
chipping away at #16
- Loading branch information
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import poloniex | ||
import unittest | ||
|
||
|
||
class TestPolo(unittest.TestCase): | ||
|
||
def test_method_integrity(self): | ||
self.polo = poloniex.Poloniex() | ||
for command in poloniex.PUBLIC_COMMANDS: | ||
self.assertTrue(hasattr(self.polo, command)) | ||
for command in poloniex.PRIVATE_COMMANDS: | ||
self.assertTrue(hasattr(self.polo, command)) | ||
self.assertTrue(hasattr(self.polo, 'marketTradeHist')) | ||
|
||
def test_coach_existance(self): | ||
self.polo = poloniex.Poloniex() | ||
# coach is created by default | ||
self.assertTrue(isinstance(self.polo.coach, poloniex.Coach)) | ||
# remove coach | ||
self.polo = poloniex.Poloniex(coach=False) | ||
self.assertFalse(self.polo.coach) | ||
# coach injection | ||
myCoach = poloniex.Coach() | ||
self.polo = poloniex.Poloniex(coach=myCoach) | ||
self.polo2 = poloniex.Poloniex(coach=myCoach) | ||
self.assertTrue(self.polo.coach is self.polo2.coach) | ||
|
||
def test_PoloniexErrors(self): | ||
self.polo = poloniex.Poloniex() | ||
# no keys, private command | ||
with self.assertRaises(poloniex.PoloniexError): | ||
self.polo.returnBalances() | ||
# invalid command | ||
with self.assertRaises(poloniex.PoloniexError): | ||
self.polo('foo') | ||
# catch errors returned from poloniex.com | ||
with self.assertRaises(poloniex.PoloniexError): | ||
self.polo.returnOrderBook(pair='atestfoo') | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |