Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4964 from rlbabyuk/replace_web_ui_password_change
Browse files Browse the repository at this point in the history
Replace change_stored_password
  • Loading branch information
psav authored Jul 12, 2017
2 parents 31d5aeb + 47f3d3b commit 5f8a0dd
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions cfme/configure/access_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
from widgetastic_patternfly import (
BootstrapSelect, Button, Input, Tab, CheckableBootstrapTreeview,
BootstrapSwitch, CandidateNotFound, Dropdown)
from widgetastic.widget import Checkbox, View, Table
from widgetastic.widget import Checkbox, View, Table, Text

from cfme.base.credential import Credential
from cfme.base.ui import ConfigurationView
from cfme.exceptions import OptionNotAvailable
from cfme.web_ui.form_buttons import change_stored_password
from utils.appliance import Navigatable
from utils.appliance.implementations.ui import navigator, CFMENavigateStep, navigate_to
from utils.log import logger
Expand Down Expand Up @@ -72,6 +71,8 @@ class EditUserView(UserForm):
""" User Edit View."""
save_button = Button('Save')
reset_button = Button('Reset')
change_stored_password = Text('#change_stored_password')
cancel_password_change = Text('#cancel_password_change')

@property
def is_displayed(self):
Expand Down Expand Up @@ -170,7 +171,7 @@ def update(self, updates):
as 'Save' button will not be active
"""
view = navigate_to(self, 'Edit')
change_stored_password()
self.change_stored_password()
new_updates = {}
if 'credential' in updates:
new_updates.update({
Expand Down Expand Up @@ -212,7 +213,6 @@ def copy(self):
view = self.create_view(AddUserView)
new_user = User(name="{}copy".format(self.name),
credential=Credential(principal='redhat', secret='redhat'))
change_stored_password()
view.fill({
'name_txt': new_user.name,
'userid_txt': new_user.credential.principal,
Expand Down Expand Up @@ -268,6 +268,25 @@ def remove_tag(self, tag, value):
view.flash.assert_success_message('Tag edits were successfully saved')
assert view.is_displayed

# TODO update elements, after 1469035 fix
def change_stored_password(self, changes=None, cancel=False):
""" Changes user password
Args:
changes: dict with fields to be changes,
if None, passwords fields only be anabled
cancel: True, if you want to disable password change
"""
view = navigate_to(self, 'Edit')
self.browser.execute_script(
self.browser.get_attribute(
'onClick', self.browser.element(view.change_stored_password)))
if changes:
view.fill(changes)
if cancel:
self.browser.execute_script(
self.browser.get_attribute(
'onClick', self.browser.element(view.cancel_password_change)))

@property
def exists(self):
try:
Expand Down

0 comments on commit 5f8a0dd

Please sign in to comment.