@@ -760,11 +760,13 @@ def test_rolename_required_error_validation(appliance):
760760 # When trying to create a role with no name, the Add button is disabled.
761761 # We are waiting for an Exception saying that there are no success
762762 # or fail messages, because the Add button cannot be clicked.
763- with pytest .raises (Exception , match = r"Available messages: \[\]" ):
764- appliance .collections .roles .create (
765- name = None ,
766- vm_restriction = 'Only User Owned'
767- )
763+ view = navigate_to (appliance .collections .roles , 'Add' )
764+ view .fill ({'name_txt' : '' ,
765+ 'vm_restriction_select' : 'Only User Owned' })
766+ assert view .add_button .disabled
767+ view .fill ({'name_txt' : 'test-required-name' })
768+ assert not view .add_button .disabled
769+ view .cancel_button .click ()
768770
769771
770772@pytest .mark .tier (3 )
@@ -777,13 +779,13 @@ def test_rolename_duplicate_validation(appliance):
777779 tags: rbac
778780 """
779781 name = 'rol{}' .format (fauxfactory .gen_alphanumeric ())
780- role = new_role ( appliance , name = name )
781- with pytest . raises ( RBACOperationBlocked ):
782- new_role (appliance , name = name )
783-
784- # Navigating away from this page will create an "Abandon Changes" alert
785- # Since group creation failed we need to reset the state of the page
786- navigate_to ( role . appliance . server , 'Dashboard' )
782+ role = appliance . collections . roles . create ( name = name )
783+ assert role . exists
784+ view = navigate_to (appliance . collections . roles , 'Add' )
785+ view . fill ({ 'name_txt' : name })
786+ view . add_button . click ()
787+ view . flash . assert_message ( 'Name has already been taken' , 'error' )
788+ view . cancel_button . click ( )
787789
788790
789791@pytest .mark .tier (3 )
0 commit comments