Esempio n. 1
0
 def test_raise_using_invalid_code(self):
     """
     Ensure that a default exception/code is used if invalid code is provided.
     """
     with self.assertRaises(CloudantIndexException) as cm:
         raise CloudantIndexException('foo')
     self.assertEqual(cm.exception.status_code, 100)
Esempio n. 2
0
 def test_raise_with_proper_code_and_args(self):
     """
     Ensure that the requested exception is raised.
     """
     with self.assertRaises(CloudantIndexException) as cm:
         raise CloudantIndexException(101)
     self.assertEqual(cm.exception.status_code, 101)
Esempio n. 3
0
 def test_raise_without_code(self):
     """
     Ensure that a default exception/code is used if none is provided.
     """
     with self.assertRaises(CloudantIndexException) as cm:
         raise CloudantIndexException()
     self.assertEqual(cm.exception.status_code, 100)