class TestAccountMethods(unittest.TestCase): """ Tests the methods that deal with retrieving basic information about the account you're authenticating as. Checks for one property on each method. """ def setUp(self): self.gengo = Gengo(public_key=API_PUBKEY, private_key=API_PRIVKEY, sandbox=True) from gengo import requests self.json_mock = mock.Mock() self.json_mock.json.return_value = {'opstat': 'ok'} self.getMock = RequestsMock(return_value=self.json_mock) self.requestsPatch = mock.patch.object(requests, 'get', self.getMock) self.requestsPatch.start() def tearDown(self): self.requestsPatch.stop() def test_getAccountStats(self): stats = self.gengo.getAccountStats() self.assertEqual(stats['opstat'], 'ok') self.getMock.assert_path_contains( mockdb.apihash['getAccountStats']['url']) def test_getAccountBalance(self): balance = self.gengo.getAccountBalance() self.assertEqual(balance['opstat'], 'ok') self.getMock.assert_path_contains( mockdb.apihash['getAccountBalance']['url'])
class TestAccountMethods(unittest.TestCase): """ Tests the methods that deal with retrieving basic information about the account you're authenticating as. Checks for one property on each method. """ def setUp(self): self.gengo = Gengo(public_key=API_PUBKEY, private_key=API_PRIVKEY, sandbox=True) self.json_mock = mock.Mock() self.json_mock.json.return_value = {'opstat': 'ok'} self.getMock = RequestsMock(return_value=self.json_mock) self.requestsPatch = mock.patch.object(requests, 'get', self.getMock) self.requestsPatch.start() def tearDown(self): self.requestsPatch.stop() def test_getAccountStats(self): stats = self.gengo.getAccountStats() self.assertEqual(stats['opstat'], 'ok') self.getMock.assert_path_contains( gengo.mockdb.apihash['getAccountStats']['url']) def test_getAccountBalance(self): balance = self.gengo.getAccountBalance() self.assertEqual(balance['opstat'], 'ok') self.getMock.assert_path_contains( gengo.mockdb.apihash['getAccountBalance']['url'])
class TestAccountMethods(unittest.TestCase): """ Tests the methods that deal with retrieving basic information about the account you're authenticating as. Checks for one property on each method. """ def setUp(self): self.gengo = Gengo(public_key=API_PUBKEY, private_key=API_PRIVKEY) self.gengo.api_url = 'http://api.staging.gengo.com/%(version)s' def test_getAccountStats(self): stats = self.gengo.getAccountStats() self.assertEqual(stats['opstat'], 'ok') def test_getAccountBalance(self): balance = self.gengo.getAccountBalance() self.assertEqual(balance['opstat'], 'ok')
class TestAccountMethods(unittest.TestCase): """ Tests the methods that deal with retrieving basic information about the account you're authenticating as. Checks for one property on each method. """ def setUp(self): self.gengo = Gengo(public_key=API_PUBKEY, private_key=API_PRIVKEY, sandbox=True) def test_getAccountStats(self): stats = self.gengo.getAccountStats() self.assertEqual(stats['opstat'], 'ok') def test_getAccountBalance(self): balance = self.gengo.getAccountBalance() self.assertEqual(balance['opstat'], 'ok')
# met: # # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # Neither the name of Gengo, Inc. nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from gengo import Gengo # Get an instance of Gengo to work with... gengo = Gengo(public_key="your_public_key", private_key="your_private_key", sandbox=False, debug=True) # Retrieve and print the account balance. print(gengo.getAccountBalance())
# this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # Neither the name of myGengo, Inc. nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from gengo import Gengo # Get an instance of Gengo to work with... gengo = Gengo( public_key='your_public_key', private_key='your_private_key', sandbox=False, debug=True ) # Retrieve and print the account balance. print gengo.getAccountBalance()
# this list of conditions and the following disclaimer. # Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # Neither the name of Gengo, Inc. nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from gengo import Gengo # Get an instance of Gengo to work with... gengo = Gengo(public_key='your_public_key', private_key='your_private_key', sandbox=False, debug=True) # Retrieve and print the account balance. print(gengo.getAccountBalance())
# this list of conditions and the following disclaimer. # Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # Neither the name of myGengo, Inc. nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from gengo import Gengo # Get an instance of Gengo to work with... gengo = Gengo(public_key='your_public_key', private_key='your_private_key', sandbox=False, debug=True) # Retrieve and print the account balance. print gengo.getAccountBalance()