Nir Soffer has posted comments on this change.

Change subject: properties: py3: properties.py and properties_test.py compliance
......................................................................


Patch Set 3:

(1 comment)

https://gerrit.ovirt.org/#/c/63230/3/tests/properties_test.py
File tests/properties_test.py:

Line 471
Line 472
Line 473
Line 474
Line 475
> I think the correct fix is:
This test is confusing the reader to think that password content is ascii. We 
should use binary data in the test:

    data = b"\x80\x81\x82\x83"
    obj.password = ProtectedPassword(base64.b64encode(data))
    self.assertEqual(data, obj.password.value)

Using this test data, incorrect decoding attempt will fail, alerting the 
developer:

    >>> b"\x80\x81\x82\x83".decode()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: 
ordinal not in range(128)

    >>> b"\x80\x81\x82\x83".decode('utf8')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib64/python2.7/encodings/utf_8.py", line 16, in decode
        return codecs.utf_8_decode(input, errors, True)
    UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0: 
invalid start byte


-- 
To view, visit https://gerrit.ovirt.org/63230
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3f49dd718d786c4a98b06c7b8757ce5a9eb6d2a
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Leon Goldberg <leon.ot...@gmail.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Leon Goldberg <leon.ot...@gmail.com>
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczew...@gmail.com>
Gerrit-Reviewer: Tomas Golembiovsky <tgole...@redhat.com>
Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org>
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to