Ejemplo n.º 1
0
 def test_get_account(self):
     stub = sinon.stub(requests, "get")
     stub.returns(fixtures.account)
     coinpit_me = Client(fixtures.private_key)
     stubc = sinon.stub(coinpit_me, "get_server_pubkey")
     stubc.returns(fixtures.auth_info.json()['serverPublicKey'])
     coinpit_me.connect()
     info = coinpit_me.get_account()
     stub.restore()
     stubc.restore()
     self.assertEqual(info, fixtures.account)
Ejemplo n.º 2
0
 def test_get_info(self):
     stub = sinon.stub(requests, "get")
     stub.returns(fixtures.info)
     coinpit_me = Client(fixtures.private_key)
     info = coinpit_me.rest.get("/all/info")
     stub.restore()
     self.assertEqual(info, fixtures.info)
Ejemplo n.º 3
0
 def test_get_unauth(self):
     stub = sinon.stub(requests, "get")
     stub.returns(fixtures.info)
     rest = Rest(fixtures.base_url)
     info = rest.get("/all/info")
     stub.restore()
     self.assertEqual(info, fixtures.info)
Ejemplo n.º 4
0
 def test_get_auth(self):
     stub = sinon.stub(requests, "get")
     stub.returns(fixtures.account)
     account = Account(fixtures.private_key, fixtures.server_pub_key)
     rest_client = Rest(fixtures.base_url, account)
     info = rest_client.get("/account")
     stub.restore()
     self.assertEqual(info, fixtures.account)
Ejemplo n.º 5
0
 def test_auth_headers(self):
     stub = sinon.stub(requests, "get")
     stub.returns(fixtures.auth_info)
     account = Account(fixtures.private_key, fixtures.server_pub_key)
     rest = Rest(fixtures.base_url, account)
     headers = rest.get_headers(fixtures.method, fixtures.uri,
                                fixtures.body)
     stub.restore()
     self.assertEqual(headers, fixtures.headers)
Ejemplo n.º 6
0
 def test_auth(self):
     stub = sinon.stub(requests, "get")
     stub.returns(fixtures.auth_info)
     coinpit_me = Client(fixtures.private_key)
     coinpit_me.connect()
     stub.restore()
     self.assertEqual(coinpit_me.account.server_pub_key,
                      fixtures.server_pub_key)
     self.assertEqual(coinpit_me.account.shared_secret,
                      binascii.unhexlify(fixtures.shared_secret))
Ejemplo n.º 7
0
 def setUp(self):
     self.stub = sinon.stub(requests, "get")
     self.stub.onCall(1).returns(fixtures.auth_info)
     self.coinpit_me = pycoinpit.Client(fixtures.private_key)
     self.coinpit_me.connect()