@@ -747,6 +747,15 @@ def test11UserUpdate(backends):
747747 user .refresh ()
748748 assert user .groupnames == origgroups
749749
750+ # Try user create
751+ try :
752+ name = "pythonbugzilla-%s" % datetime .datetime .today ()
753+ bz .createuser (name + "@example.com" , name , name )
754+ except Exception as e :
755+ if have_admin :
756+ raise
757+ assert "Sorry, you aren't a member" in str (e )
758+
750759
751760def test11ComponentEditing (backends ):
752761 bz = _open_bz (** backends )
@@ -798,10 +807,6 @@ def compare(data, newid):
798807 # bugzilla 5 error string
799808 ("You are not allowed" in str (e )))
800809
801- # bugzilla.redhat.com doesn't have REST editcomponent yet
802- tests .utils .skip_if_rest (
803- bz , "editcomponent not supported for redhat REST API" )
804-
805810 # Edit component
806811 data = basedata .copy ()
807812 data .update ({
@@ -817,11 +822,15 @@ def compare(data, newid):
817822 if newid is not None :
818823 compare (data , newid )
819824 except Exception as e :
820- if have_admin :
825+ if bz .is_rest ():
826+ # redhat REST does not support component editing
827+ assert "A REST API resource was not found" in str (e )
828+ elif have_admin :
821829 raise
822- assert (("Sorry, you aren't a member" in str (e )) or
823- # bugzilla 5 error string
824- ("You are not allowed" in str (e )))
830+ else :
831+ assert (("Sorry, you aren't a member" in str (e )) or
832+ # bugzilla 5 error string
833+ ("You are not allowed" in str (e )))
825834
826835
827836def test13SubComponents (backends ):
@@ -843,14 +852,10 @@ def test13SubComponents(backends):
843852 "Default / Unclassified (RHEL5)" ]}
844853
845854
846- def test14ExternalTrackersAddUpdateRemoveQuery (backends ):
847- bz = _open_bz (** backends )
855+ def _testExternalTrackers (bz ):
848856 bugid = 461686
849857 ext_bug_id = 380489
850858
851- tests .utils .skip_if_rest (
852- bz , "unknown if REST API has externaltrackers support" )
853-
854859 # Delete any existing external trackers to get to a known state
855860 ids = [bug ['id' ] for bug in bz .getbug (bugid ).external_bugs ]
856861 if ids != []:
@@ -895,6 +900,16 @@ def test14ExternalTrackersAddUpdateRemoveQuery(backends):
895900 assert len (ids ) == 0
896901
897902
903+ def test14ExternalTrackersAddUpdateRemoveQuery (backends ):
904+ bz = _open_bz (** backends )
905+ try :
906+ _testExternalTrackers (bz )
907+ except Exception as e :
908+ if not bz .is_rest ():
909+ raise
910+ assert "No REST API available" in str (e )
911+
912+
898913def test15EnsureLoggedIn (run_cli , backends ):
899914 bz = _open_bz (** backends )
900915 comm = "bugzilla --ensure-logged-in query --bug_id 979546"
@@ -913,24 +928,27 @@ def test16ModifyTags(run_cli, backends):
913928 bz = _open_bz (** backends )
914929 bug = bz .getbug (bugid )
915930
916- tests .utils .skip_if_rest (bz , "update_tags not supported for REST API" )
931+ try :
932+ if bug .tags :
933+ bz .update_tags (bug .id , tags_remove = bug .tags )
934+ bug .refresh ()
935+ assert bug .tags == []
917936
918- if bug .tags :
919- bz .update_tags (bug .id , tags_remove = bug .tags )
937+ run_cli (cmd + "--tags foo --tags +bar --tags baz" , bz )
920938 bug .refresh ()
921- assert bug .tags == []
922-
923- run_cli (cmd + "--tags foo --tags +bar --tags baz" , bz )
924- bug .refresh ()
925- assert bug .tags == ["foo" , "bar" , "baz" ]
939+ assert bug .tags == ["foo" , "bar" , "baz" ]
926940
927- run_cli (cmd + "--tags=-bar" , bz )
928- bug .refresh ()
929- assert bug .tags == ["foo" , "baz" ]
941+ run_cli (cmd + "--tags=-bar" , bz )
942+ bug .refresh ()
943+ assert bug .tags == ["foo" , "baz" ]
930944
931- bz .update_tags (bug .id , tags_remove = bug .tags )
932- bug .refresh ()
933- assert bug .tags == []
945+ bz .update_tags (bug .id , tags_remove = bug .tags )
946+ bug .refresh ()
947+ assert bug .tags == []
948+ except Exception as e :
949+ if not bz .is_rest ():
950+ raise
951+ assert "No REST API available" in str (e )
934952
935953
936954def test17LoginAPIKey (backends ):
0 commit comments