コード例 #1
0
 def testQueryThrowsException(self):
     with HTTMock(billomat_mock_exception):
         client = base.Client()
         self.assertRaisesRegexp(
             base.BillomatRequestException,
             'request failed.*',
             client.query,
             ('test', ),
         )
コード例 #2
0
ファイル: client.py プロジェクト: shofinetz/billomat
 def testQueryThrowsExceptionOnInvalidResponse(self):
     with HTTMock(billomat_mock_return_malformed):
         client = base.Client()
         self.assertRaisesRegexp(
             base.BillomatRequestException,
             'malformed.*',
             client.query,
             ('test', ),
         )
コード例 #3
0
ファイル: client.py プロジェクト: shofinetz/billomat
 def testQueryThrowsExceptionWithMessage(self):
     with HTTMock(billomat_mock_return_error):
         client = base.Client()
         self.assertRaisesRegexp(
             base.BillomatRequestException,
             FIXTURE_MESSAGE,
             client.query,
             ('test', ),
         )
コード例 #4
0
ファイル: client.py プロジェクト: shofinetz/billomat
 def testQueryThrowsExceptionOnNoneResponse(self):
     with HTTMock(billomat_mock_return_none):
         client = base.Client()
         self.assertRaisesRegexp(
             base.BillomatRequestException,
             'null.*',
             client.query,
             ('test', ),
         )
コード例 #5
0
 def get_client(self):
     client = base.Client()
     client.api_key = ''
     return client
コード例 #6
0
ファイル: client.py プロジェクト: shofinetz/billomat
 def testQueryOk(self):
     with HTTMock(billomat_mock_ok):
         client = base.Client()
         result = client.query('test')
         self.assertEqual(result, FIXTURE_OBJECT)
コード例 #7
0
ファイル: client.py プロジェクト: shofinetz/billomat
 def testQueryReturnsEmptyList(self):
     with HTTMock(billomat_mock_return_empty):
         client = base.Client()
         result = client.query('test')
         self.assertEqual(result, {})