Uploaded image for project: 'Nuxeo Python Client'
  1. Nuxeo Python Client
  2. NXPY-108

[Python 2] Fix repr(HTTPError) with non-ascii characters in the message

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.2.1
    • Component/s: None

      Description

      tests/test_nuxeo.py::test_unauthorized FAILED                                                                               [100%]
      
      ============================================================ FAILURES =============================================================
      ________________________________________________________ test_unauthorized ________________________________________________________
      
      server = <nuxeo.client.Nuxeo object at 0x7f24490cf3d0>
      
          def test_unauthorized(server):
              username = 'alice'
              password = 'test'
              auth = server.client.auth
              server.client.auth = (get_bytes(username), password)
              try:
                  with pytest.raises(Unauthorized) as e:
                      server.users.create(
                          User(properties={
                              'username': 'another_one',
                              'password': 'test'
                          }))
                  print(e)
      >           print(e.value)
      
      auth       = ('Administrator', 'Administrator')
      e          = <ExceptionInfo Unauthorized tblen=4>
      password   = 'test'
      server     = <nuxeo.client.Nuxeo object at 0x7f24490cf3d0>
      username   = 'alice'
      
      tests/test_nuxeo.py:294: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
      nuxeo/exceptions.py:69: in __str__
          return repr(self)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
      
      self = <[UnicodeDecodeError("'ascii' codec can't decode byte 0xe2 in position 60: ordinal not in range(128)") raised in repr()] SafeRepr object at 0x7f24490af248>
      
          def __repr__(self):
              # type: () -> Text
              return '%s(%d), error: %s, server trace: %s' % (
      >           type(self).__name__, self.status, self.message, self.stacktrace)
      E       UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 60: ordinal not in range(128)
      
      self       = <[UnicodeDecodeError("'ascii' codec can't decode byte 0xe2 in position 60: ordinal not in range(128)") raised in repr()] SafeRepr object at 0x7f2448ffaef0>
      
      nuxeo/exceptions.py:65: UnicodeDecodeError
      ------------------------------------------------------ Captured stdout call -------------------------------------------------------
      nuxeo/client.py:209: Unauthorized: <unprintable Unauthorized object>
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 15 minutes
                15m