Skip to content
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

Tests: Basic coverage with tree root domain #448

Closed
wants to merge 1 commit into from

Conversation

gkaihorodova
Copy link
Contributor

@gkaihorodova gkaihorodova commented Feb 8, 2017

Tests: Basic coverage with tree root domain
Extend existing legacy client tests to cover test cases with tree root domain.
https://fedorahosted.org/freeipa/ticket/6489

testuser = 'treetestuser@{0}'.format(self.ad_treedomain)
result = self.legacy_client.run_command(['getent', 'passwd', testuser])

testuser_regex = "treetestuser@%s:\*:%s:%s:"\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backslashes in multiline strings are discouraged by PEP-8, please enclose the whole string literal in parentheses and leave out backslashes.

Also please try to use new-style string formatting in new code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for review. I'll try to rewrite that part using new-style string formatting.

@martbab
Copy link
Contributor

martbab commented Feb 8, 2017

I have quickly skimmed through code and have one comment. Also, I have noticed the extreme code triplication of the test cases. I think that this warrants some refactoring first before adding tree-root domain tests.

@gkaihorodova
Copy link
Contributor Author

Can you be a little bit more specific about "triplication of the test cases ", please.
Because, to be honest, I'm having hard time trying to navigate myself there.

@martbab
Copy link
Contributor

martbab commented Feb 10, 2017

If you look at the test cases (e.g. test_login_ipa-user, test_login_ad_user, test_login_subdomain_user are the 'best: examples) you can see that the function body is the same code copy-pasted with slight alterations so that it works for the new case. Your patch adds a fourth level of copy-pasta to the code, which is something that grieves me greatly.

Clearly, you can group the common code into a private method that can be only called with the use-case specific parameters for each test case. Or you can expand the existing mixing hierarchy to achieve this. Then it would also be simpler to extend the test cases for tree-root domains.

@gkaihorodova
Copy link
Contributor Author

Thank you for explanation and tips. I noticed it as well and I agree that it (and not only that) worth refactoring. Yes, my PR is more or less copy-paste, because I was following existing pattern in the code.
Also I think PR can be pushed and at the same time feel free to open ticket/request or whatever is more suitable for refactoring task and signed it to me.
Please, don t be grieve, it makes me sad

@martbab
Copy link
Contributor

martbab commented Feb 10, 2017

Well you still have some issues to fix, notably the failing Travis CI and the not-so nice multiline-string literal.

@gkaihorodova
Copy link
Contributor Author

Yes, sure I'll work on these issues

Extend existing legacy client tests to cover test cases with tree root domain.

https://fedorahosted.org/freeipa/ticket/6489
@gkaihorodova
Copy link
Contributor Author

Bump for review

@martbab martbab added the ack Pull Request approved, can be merged label Feb 28, 2017
@martbab
Copy link
Contributor

martbab commented Feb 28, 2017

The patch looks ok, let's hope that our CI will play nice with it.

@gkaihorodova
Copy link
Contributor Author

Thanks you for review. Let's hope for the best .

@martbab martbab added the pushed Pull Request has already been pushed label Mar 1, 2017
@martbab
Copy link
Contributor

martbab commented Mar 1, 2017

master:

  • 10494b1 Tests: Basic coverage with tree root domain

@martbab martbab closed this Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
2 participants