コード例 #1
0
ファイル: exception_test.py プロジェクト: EdDev/vdsm
 def test_info(self):
     e = ContextException("not hot enough", temperature=42)
     self.assertEqual(e.info(), {"code": 0, "message": str(e)})
コード例 #2
0
ファイル: exception_test.py プロジェクト: EdDev/vdsm
 def test_response(self):
     e = ContextException("not hot enough", temperature=42)
     self.assertEqual(e.response(), {"status": e.info()})
コード例 #3
0
ファイル: exception_test.py プロジェクト: xiaojiongming/vdsm
 def test_info(self):
     e = ContextException("not hot enough", temperature=42)
     self.assertEqual(e.info(), {"code": 0, "message": str(e)})
コード例 #4
0
ファイル: exception_test.py プロジェクト: xiaojiongming/vdsm
 def test_response(self):
     e = ContextException("not hot enough", temperature=42)
     self.assertEqual(e.response(), {"status": e.info()})
コード例 #5
0
ファイル: exception_test.py プロジェクト: xiaojiongming/vdsm
 def test_str(self):
     e = ContextException("not hot enough", temperature=42)
     self.assertEqual(str(e), "%s: %s" % (e.message, e.context))
コード例 #6
0
ファイル: exception_test.py プロジェクト: xiaojiongming/vdsm
 def test_context_reason_and_kwargs(self):
     e = ContextException("not hot enough", temperature=42)
     self.assertEqual(e.context,
                      dict(reason="not hot enough", temperature=42))
コード例 #7
0
ファイル: exception_test.py プロジェクト: xiaojiongming/vdsm
 def test_context_explicit_reason(self):
     e = ContextException(reason="not hot enough")
     self.assertEqual(e.context, dict(reason="not hot enough"))
コード例 #8
0
ファイル: exception_test.py プロジェクト: xiaojiongming/vdsm
 def test_context_single_argument(self):
     e = ContextException("not hot enough")
     self.assertEqual(e.context, dict(reason="not hot enough"))
コード例 #9
0
ファイル: exception_test.py プロジェクト: xiaojiongming/vdsm
 def test_context_no_arguments(self):
     e = ContextException()
     self.assertEqual(e.context, {})