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

Certificate mapping test #399

Closed
wants to merge 10 commits into from
Closed

Certificate mapping test #399

wants to merge 10 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 18, 2017

@martbab martbab self-assigned this Feb 10, 2017
raise NotImplementedError(self._override_me_msg)

class Tracker(RetrievableTracker, SearchableTracker, MutableTracker,
CreatableTracker):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fill in the docstrings for the parent classes and describe their intended usage there.


request.addfinalizer(cleanup)

return super(CreatableTracker, self).make_fixture(request)
raise NotImplementedError(self._override_me_msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the leftover raise statement

if got:
assert_deepequal(expected, got)
else:
assert("Command didn't returned")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this line read assert False, "Command didn't return"?

(CREATE_PERM, errors.ACIError, None,),
(READ_PERM, errors.NotFound, None,),
],
):
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a lot of duplication of the same parameters passed to the execute_with_expected. Please hide common code into a separate private method or use functools.partial.

try:
certmap_rule.delete()
except Exception:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

this is also copy-pasted a lot so it warrants a separate method for that.


def test_update(self, certmap_rule, certmap_user_permissions):
certmap_rule.ensure_missing()
certmap_rule.ensure_exists()
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason why some of the tests use ensure_missing followed by ensure_exists and some just use ensure_exists?

@martbab
Copy link
Contributor

martbab commented Feb 21, 2017

I have some inline comments. I was also thinking about the nomenclature of the Tracker mixins and I think we should name them based on the noun of the action that is being tracked, e.g:

RetrievalTracker
SearchTracker
CreationTracker
ModificationTracker

@flo-renaud flo-renaud self-assigned this Feb 22, 2017
Copy link
Contributor

@flo-renaud flo-renaud left a comment

Choose a reason for hiding this comment

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

Hi @dkupka ,
thanks for all those tests!
My inline comments are mainly related to late design changes (name of options or attributes that are not used).

u'nsContainer',
u'ipaCertMapContainer',
u'ipaCertMapConfigObject',
]
Copy link
Contributor

Choose a reason for hiding this comment

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

The schema was simplified and will only contain top, nsContainer and ipacertmapconfigobject

u'consumed by SSSD',
u'ipacertmapmatchrule': u'arbitrary free-form matching rule defined '
u'and consumed by SSSD',
u'associateddomain': u'example.org',
Copy link
Contributor

Choose a reason for hiding this comment

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

certmaprule-add has a check on the 'associateddomain' attribute. It must either be FreeIPA domain or a trusted domain. Because of this check, the creation with this constant is likely to fail.

u'ipacertmapissuer': DN('CN=Changed CA,O=OTHER.ORG'),
u'ipacertmapmaprule': u'changed arbitrary mapping rule',
u'ipacertmapmatchrule': u'changed arbitrary maching rule',
u'associateddomain': u'changed.example.org',
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above: associateddomain must either be FreeIPA domain or a trusted domain.

u'cn': u'test_rule',
u'description': u'Certificate mapping and matching rule for test '
u'purposes',
u'ipacertmapissuer': DN('CN=CA,O=EXAMPLE.ORG'),
Copy link
Contributor

Choose a reason for hiding this comment

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

The issuer attribute has been removed from the original design


certmaprule_update_params = {
u'description': u'Changed description',
u'ipacertmapissuer': DN('CN=Changed CA,O=OTHER.ORG'),
Copy link
Contributor

Choose a reason for hiding this comment

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

The issuer has been removed from the original design.

u'dn',
u'cn',
u'description',
u'ipacertmapissuer',
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove ipacertmapissuer attribute

self.api.env.basedn)
self.options = {
u'description': description,
u'ipacertmapissuer': ipacertmapissuer,
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove ipacertmapissuer attribute.

u'objectclass',
u'aci',
u'ipacertmapversion',
u'ipaconfigstring'
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove ipacertmapversion and ipaconfigstring

u'cn': [self.api.env.container_certmap[0].value],
u'objectclass': objectclasses.certmapconfig,
u'ipacertmapversion': [u'1'],
u'ipaconfigstring': [u'CertMapVersion 1'],
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove ipacertmapversion and ipaconfigstring

):
raise MutuallyExclusiveError(reason=u'Mutually exclusive options '
u'provided at the same time.')

Copy link
Contributor

Choose a reason for hiding this comment

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

You can also add a requirement: if subject or issuer is provided, then the other one is also required.

@stlaz
Copy link
Contributor

stlaz commented Jul 27, 2017

This's been hanging here for long enough, why isn't it finished? I don't see any postponed label here, do we know whether it's somehow blocked?

@ghost ghost mentioned this pull request Aug 15, 2017
@ghost ghost closed this Aug 15, 2017
@ghost ghost unassigned martbab Aug 15, 2017
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants