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
ipatests: webui: test_host.py Fix expected item visibility #5110
Conversation
@miskopo |
I finally got it... I think you should call assert_action_list_action(visible=True, enabled=False) as the menu item is visible but grayed out. |
Fix test to expect `request_cert` to be visible in host drop-down menu. Resolves: https://pagure.io/freeipa/issue/8504 Signed-off-by: Michal Polovka <mpolovka@redhat.com>
Thank you @flo for comments, I've incorporated your suggestions. |
Okay, I see it now, |
Are we sure that the test change is correct? I.e. is there a valid reason to change the test? E.g. was there a change in behavior of Web UI or something else to display the items differently? I'm bit out of touch, so I don't recall that. @serg-cymbaluk do you know? If I look into Web UI source code. I see still an indication that if IPA.cert.request_action = function(spec) {
spec = spec || {};
spec.name = spec.name || 'request_cert';
spec.label = spec.label || '@i18n:objects.cert.new_certificate';
spec.enable_cond = spec.enable_cond || ['ra_enabled'];
spec.hide_cond = spec.hide_cond || ['ra_disabled']; IPA.cert.revoke_action = function(spec) {
spec = spec || {};
spec.name = spec.name || 'revoke_cert';
spec.label = spec.label || '@i18n:objects.cert.revoke_certificate_simple';
spec.enable_cond = spec.enable_cond || ['has_certificate'];
spec.disable_cond = spec.disable_cond || ['certificate_revoked'];
spec.hide_cond = spec.hide_cond || ['ra_disabled'];
spec.confirm_dialog = spec.confirm_dialog || IPA.cert.revoke_dialog;
spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true; IPA.cert.remove_hold_action = function(spec) {
spec = spec || {};
spec.name = spec.name || 'remove_hold_cert';
spec.label = spec.label || '@i18n:objects.cert.remove_hold';
spec.enable_cond = spec.enable_cond || ['has_certificate', 'certificate_hold'];
spec.hide_cond = spec.hide_cond || ['ra_disabled']; Later: IPA.cert.certificate_evaluator = function(spec) {
spec.name = spec.name || 'has_certificate_evaluator';
spec.event = spec.event || 'certificate_loaded';
var that = IPA.state_evaluator(spec);
that.on_event = function(certificate) {
var old_state, record, state, value, loaded_value;
old_state = that.state;
that.state = [];
if (certificate && certificate.certificate) {
that.state.push('has_certificate');
if (certificate.revocation_reason !== undefined) {
that.state.push('certificate_revoked');
if (certificate.revocation_reason === 6) {
that.state.push('certificate_hold');
}
}
}
if (IPA.cert.is_enabled()) {
that.state.push('ra_enabled');
} else {
that.state.push('ra_disabled');
}
that.notify_on_change(old_state);
};
return that;
}; IPA.cert.is_enabled = function() {
return !!IPA.ca_enabled;
}; batch.add_command(rpc.command({
entity: 'ca',
method: 'is_enabled',
on_success: function(data, text_status, xhr) {
that.ca_enabled = data.result;
}
})); |
The question was why is it a valid change? Nobody mentioned the reason yet. |
@pvoborni @miskopo @serg-cymbaluk The behavior of the drop-down menu is different depending on the version. The "New certificate" action for users/services/hosts is sometimes displayed (=visible), sometimes grayed out (=visible but disabled), sometimes not displayed (=hidden):
This is the result of issues https://pagure.io/freeipa/issue/8369 and https://pagure.io/freeipa/issue/8203. They are now fixed on ipa-4-6, ipa-4-8, ipa-4-9 and master branches (the right behavior is the one seen on 4.8.10), but not yet delivered to RHEL. As a summary, I think we don't need this fix anymore as the test is already consistent with the code in the branches. |
I am closing this PR based on the investigation by @flo-renaud in #5110 (comment) |
Fix test to expect
request_cert
to be visible in host drop-down menu.Resolves: https://pagure.io/freeipa/issue/8504
Signed-off-by: Michal Polovka mpolovka@redhat.com