示例#1
0
 def test_raise_with_proper_code_and_args(self):
     """
     Ensure that the requested exception is raised.
     """
     with self.assertRaises(CloudantReplicatorException) as cm:
         raise CloudantReplicatorException(404, 'foo')
     self.assertEqual(cm.exception.status_code, 404)
示例#2
0
 def test_raise_using_invalid_code(self):
     """
     Ensure that a default exception/code is used if invalid code is provided.
     """
     with self.assertRaises(CloudantReplicatorException) as cm:
         raise CloudantReplicatorException('foo')
     self.assertEqual(cm.exception.status_code, 100)
示例#3
0
 def test_raise_without_code(self):
     """
     Ensure that a default exception/code is used if none is provided.
     """
     with self.assertRaises(CloudantReplicatorException) as cm:
         raise CloudantReplicatorException()
     self.assertEqual(cm.exception.status_code, 100)
示例#4
0
 def test_raise_without_args(self):
     """
     Ensure that a default exception/code is used if the message requested
     by the code provided requires an argument list and none is provided.
     """
     with self.assertRaises(CloudantReplicatorException) as cm:
         raise CloudantReplicatorException(404)
     self.assertEqual(cm.exception.status_code, 100)