Skip to content

Refactor AttributeValueBase set_text method #545

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

Merged

Conversation

c00kiemon5ter
Copy link
Member

@c00kiemon5ter c00kiemon5ter commented Sep 4, 2018

This changeset is a refactor of the AttributeValueBase.set_text() method.
The rewrite is done in a declarative fashion. The mappings define the behaviour of the code, while the flow is common for all types.
The changeset also adds new tests that describe the behaviour of the function and make sure that the rewrite behaves the same way.

Related to #539 #543 #544 #546

All Submissions:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what problem you are trying to solve with this PR?
  • Have you added information on what your changes do and why you chose this as your solution?
  • Have you written new tests for your changes?
  • Does your submission pass tests?
  • This project follows PEP8 style guide. Have you run your code against the 'flake8' linter?

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
@c00kiemon5ter
Copy link
Member Author

@cmurphy @jdavisturak @nebularazer feel free to report back the results if you test this patch.

@c00kiemon5ter c00kiemon5ter changed the title Refactor av set text Refactor AttributeValueBase set_text method Sep 4, 2018
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
@codecov-io
Copy link

codecov-io commented Sep 6, 2018

Codecov Report

Merging #545 into master will increase coverage by 0.03%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #545      +/-   ##
==========================================
+ Coverage   65.48%   65.52%   +0.03%     
==========================================
  Files         103      103              
  Lines       25657    25598      -59     
==========================================
- Hits        16802    16772      -30     
+ Misses       8855     8826      -29
Impacted Files Coverage Δ
src/saml2/saml.py 94.46% <92.85%> (+2.07%) ⬆️
src/saml2/time_util.py 86.82% <0%> (-0.6%) ⬇️
src/saml2/validate.py 76.07% <0%> (+2.35%) ⬆️

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 e2675f7...23b3bc5. Read the comment docs.

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
@jonespm
Copy link

jonespm commented Sep 6, 2018

I tested based on the issue on #546. It's giving a different error now.

ValueError
Type and value do not match: xsd:string:<class 'str'>:urn:mace:dir:entitlement:common-lib-terms
/usr/local/lib/python3.5/site-packages/saml2/saml.py in _wrong_type_value, line 206
/usr/local/bin/python
3.5.5

I think it's still just checking types in the xs: namespace?

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
If the xsd string comes with a namespace prefix, it is left intact.
If the xsd string has no namespace prefix and the xsd type is known,
the xsd namespace is set to 'xs'.
If the xsd string has no namespace and the type is unknown,
the xsd namespace is left empty.

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
@jonespm
Copy link

jonespm commented Sep 6, 2018

Yes, @c00kiemon5ter the latest commit solves #546 and it works. Thanks!

@c00kiemon5ter c00kiemon5ter merged commit 8474950 into IdentityPython:master Sep 6, 2018
@c00kiemon5ter
Copy link
Member Author

@cmurphy @jdavisturak @nebularazer @jonespm just released v4.6.2 with this changeset.

@jdavisturak
Copy link

This fixes the issue I was seeing. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants