Example #1
0
 def test_extract_status(self):
     self.assertIsNone(_extract_status(None))
     self.assertEqual(
         _extract_status(SpanStatus(canonical_code=StatusCanonicalCode.OK)),
         Status(details=None, code=0),
     )
     self.assertEqual(
         _extract_status(
             SpanStatus(
                 canonical_code=StatusCanonicalCode.UNKNOWN,
                 description="error_desc",
             )),
         Status(details=None, code=2, message="error_desc"),
     )
 def test_extract_status_code_future_added(self):
     self.assertEqual(
         _extract_status(
             SpanStatus(
                 status_code=mock.Mock(),
                 description="unknown_description",
             )),
         Status(code=code_pb2.UNKNOWN, message="unknown_description"),
     )
 def test_extract_status_code_error(self):
     self.assertEqual(
         _extract_status(
             SpanStatus(
                 status_code=StatusCode.ERROR,
                 description="error_desc",
             )),
         Status(code=code_pb2.UNKNOWN, message="error_desc"),
     )
 def test_extract_status_code_and_desc(self):
     self.assertEqual(
         _extract_status(
             SpanStatus(
                 status_code=StatusCode.UNSET,
                 description="error_desc",
             )),
         Status(details=None,
                code=StatusCode.UNSET.value,
                message="error_desc"),
     )
 def test_extract_status_code(self):
     self.assertEqual(
         _extract_status(SpanStatus(status_code=StatusCode.OK)),
         Status(details=None, code=StatusCode.OK.value),
     )
 def test_extract_status_code_ok(self):
     self.assertEqual(
         _extract_status(SpanStatus(status_code=StatusCode.OK)),
         Status(code=code_pb2.OK),
     )
 def test_extract_status_code_unset(self):
     self.assertIsNone(
         _extract_status(SpanStatus(status_code=StatusCode.UNSET)))
 def test_extract_status_code_future_added(self):
     self.assertEqual(
         _extract_status(SpanStatus(status_code=mock.Mock(), )),
         Status(code=code_pb2.UNKNOWN),
     )
Example #9
0
 def test_extract_status_code(self):
     self.assertEqual(
         _extract_status(SpanStatus(canonical_code=StatusCanonicalCode.OK)),
         Status(details=None, code=0),
     )