New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make token and tokenclass tests work with Python 3 #1411

Merged
merged 3 commits into from Jan 30, 2019

Conversation

Projects
None yet
2 participants
@plettich
Copy link
Contributor

plettich commented Jan 30, 2019

Working on #676

Merging #1411 into master will decrease coverage by 0.11%.
The diff coverage is 100%.
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1411      +/-   ##
==========================================
- Coverage   96.76%   96.65%   -0.12%
==========================================
Files         144      144
Lines       17215    17207       -8
==========================================
- Hits        16658    16631      -27
- Misses        557      576      +19
Impacted Files Coverage Δ
privacyidea/lib/tokenclass.py 98.96% <100%> (-0.01%) ⬇️
privacyidea/lib/token.py 95.88% <100%> (ø) ⬆️
privacyidea/lib/tokens/hotptoken.py 100% <100%> (ø) ⬆️
privacyidea/lib/tokens/HMAC.py 100% <100%> (+1.53%) ⬆️
privacyidea/lib/utils.py 96% <100%> (+0.22%) ⬆️
privacyidea/lib/log.py 34.24% <0%> (-16.44%) ⬇️
privacyidea/lib/tokens/u2f.py 91.66% <0%> (-2.5%) ⬇️
privacyidea/lib/security/default.py 96.13% <0%> (-1.66%) ⬇️
privacyidea/lib/tokens/vasco.py 96.72% <0%> (-1.64%) ⬇️
privacyidea/lib/subscriptions.py 87.2% <0%> (-0.8%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e605fb4...1ad4176. Read the comment docs.

  

@plettich plettich requested a review from privacyidea/core Jan 30, 2019

@codecov

This comment has been minimized.

Copy link

codecov bot commented Jan 30, 2019

Codecov Report

Merging #1411 into master will decrease coverage by 0.11%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1411      +/-   ##
==========================================
- Coverage   96.76%   96.65%   -0.12%     
==========================================
  Files         144      144              
  Lines       17215    17207       -8     
==========================================
- Hits        16658    16631      -27     
- Misses        557      576      +19
Impacted Files Coverage Δ
privacyidea/lib/tokenclass.py 98.96% <100%> (-0.01%) ⬇️
privacyidea/lib/token.py 95.88% <100%> (ø) ⬆️
privacyidea/lib/tokens/hotptoken.py 100% <100%> (ø) ⬆️
privacyidea/lib/tokens/HMAC.py 100% <100%> (+1.53%) ⬆️
privacyidea/lib/utils.py 96% <100%> (+0.22%) ⬆️
privacyidea/lib/log.py 34.24% <0%> (-16.44%) ⬇️
privacyidea/lib/tokens/u2f.py 91.66% <0%> (-2.5%) ⬇️
privacyidea/lib/security/default.py 96.13% <0%> (-1.66%) ⬇️
privacyidea/lib/tokens/vasco.py 96.72% <0%> (-1.64%) ⬇️
privacyidea/lib/subscriptions.py 87.2% <0%> (-0.8%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e605fb4...1ad4176. Read the comment docs.

@codecov

This comment has been minimized.

Copy link

codecov bot commented Jan 30, 2019

Codecov Report

Merging #1411 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1411      +/-   ##
==========================================
+ Coverage   96.76%   96.78%   +0.02%     
==========================================
  Files         144      144              
  Lines       17215    17207       -8     
==========================================
- Hits        16658    16654       -4     
+ Misses        557      553       -4
Impacted Files Coverage Δ
privacyidea/lib/tokenclass.py 98.96% <100%> (-0.01%) ⬇️
privacyidea/lib/token.py 95.88% <100%> (ø) ⬆️
privacyidea/lib/tokens/hotptoken.py 100% <100%> (ø) ⬆️
privacyidea/lib/tokens/HMAC.py 100% <100%> (+1.53%) ⬆️
privacyidea/lib/utils.py 96% <100%> (+0.22%) ⬆️
privacyidea/lib/tokens/u2f.py 95.83% <0%> (+1.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e605fb4...933d699. Read the comment docs.

@cornelinux
Copy link
Member

cornelinux left a comment

Minor documentation aspects and cosmetics

h_serial = binascii.hexlify(os.urandom(h_len)).upper()[0:h_len]
return "{0!s}{1!s}{2!s}".format(_prefix, num_str, h_serial)
h_serial = hexlify_and_unicode(os.urandom(h_len)).upper()[0:h_len]
return u"{0!s}{1!s}{2!s}".format(_prefix, num_str, h_serial)

This comment has been minimized.

@cornelinux

cornelinux Jan 30, 2019

Member

The serial number will never contain a non-ascii character.
So should we omit the u"" since Python 3 also would not recommend it?

This comment has been minimized.

@plettich

plettich Jan 30, 2019

Author Contributor

fixed in 933d699

@@ -1620,12 +1617,13 @@ def generate_symmetric_key(self, server_component, client_component,
server component with bytes of the client component.
:param server_component: The component usually generated by privacyIDEA
:type server_component: hex string
:type server_component: str

This comment has been minimized.

@cornelinux

cornelinux Jan 30, 2019

Member

I would like to preserve the information, that the expected string is in hex format. Then we should at least put this in the docstring.

This comment has been minimized.

@plettich

plettich Jan 30, 2019

Author Contributor

fixed in 933d699

:param client_component: The component usually generated by the
client (e.g. smartphone)
:type server_component: hex string
:type client_component: str

This comment has been minimized.

@cornelinux

This comment has been minimized.

@plettich

plettich Jan 30, 2019

Author Contributor

fixed in 933d699

@cornelinux cornelinux merged commit 7cae3f7 into master Jan 30, 2019

5 checks passed

ci/circleci Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 96.76%)
Details
codecov/project 96.78% (+0.02%) compared to e605fb4
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@cornelinux cornelinux deleted the python3_update_token_tests branch Jan 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment