Пример #1
0
 def testQueryThrowsException(self):
     with HTTMock(billomat_mock_exception):
         client = base.Client()
         self.assertRaisesRegexp(
             base.BillomatRequestException,
             'request failed.*',
             client.query,
             ('test', ),
         )
Пример #2
0
 def testQueryThrowsExceptionOnInvalidResponse(self):
     with HTTMock(billomat_mock_return_malformed):
         client = base.Client()
         self.assertRaisesRegexp(
             base.BillomatRequestException,
             'malformed.*',
             client.query,
             ('test', ),
         )
Пример #3
0
 def testQueryThrowsExceptionWithMessage(self):
     with HTTMock(billomat_mock_return_error):
         client = base.Client()
         self.assertRaisesRegexp(
             base.BillomatRequestException,
             FIXTURE_MESSAGE,
             client.query,
             ('test', ),
         )
Пример #4
0
 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
 def testQueryOk(self):
     with HTTMock(billomat_mock_ok):
         client = base.Client()
         result = client.query('test')
         self.assertEqual(result, FIXTURE_OBJECT)
Пример #7
0
 def testQueryReturnsEmptyList(self):
     with HTTMock(billomat_mock_return_empty):
         client = base.Client()
         result = client.query('test')
         self.assertEqual(result, {})