@@ -65,7 +65,7 @@ class RHPartnerTest(BaseTest):
6565 # Despite its name, this instance is simply for bugzilla testing,
6666 # doesn't send out emails and is blown away occasionally. The front
6767 # page has some info.
68- url = tests .REDHAT_URL or "https:// partner-bugzilla.redhat.com/xmlrpc.cgi "
68+ url = tests .REDHAT_URL or "partner-bugzilla.redhat.com"
6969 bzclass = bugzilla .RHBugzilla
7070
7171
@@ -78,22 +78,24 @@ def _check_have_admin(self, bz, funcname):
7878 print ("\n No admin privs, reduced testing of %s" % funcname )
7979 return ret
8080
81- def _check_rh_privs (self , bz , funcname , authtype , quiet = False ):
82- noprivs = bool (bz .getbugs ([184858 ]) == [None ])
83- if noprivs and not quiet :
84- print ("\n No RH %s privs, skipping %s" % (authtype , funcname ))
85- return not noprivs
81+ test2 = BaseTest ._testBZClass
8682
8783
88- test1 = BaseTest ._testCookieOrToken
89- test2 = BaseTest ._testBZClass
84+ def test00LoginState (self ):
85+ bz = self .bzclass (url = self .url )
86+ self .assertTrue (bz .logged_in ,
87+ "R/W tests require cached login credentials for url=%s" % self .url )
88+
89+ bz = self .bzclass (url = self .url , use_creds = False )
90+ self .assertFalse (bz .logged_in ,
91+ "Login state check failed for logged out user." )
9092
9193
9294 def test03NewBugBasic (self ):
9395 """
9496 Create a bug with minimal amount of fields, then close it
9597 """
96- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
98+ bz = self .bzclass (url = self .url )
9799 component = "python-bugzilla"
98100 version = "rawhide"
99101 summary = ("python-bugzilla test basic bug %s" %
@@ -131,7 +133,7 @@ def test04NewBugAllFields(self):
131133 """
132134 Create a bug using all 'new' fields, check some values, close it
133135 """
134- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
136+ bz = self .bzclass (url = self .url )
135137
136138 summary = ("python-bugzilla test manyfields bug %s" %
137139 datetime .datetime .today ())
@@ -195,7 +197,7 @@ def test05ModifyStatus(self):
195197 """
196198 Modify status and comment fields for an existing bug
197199 """
198- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
200+ bz = self .bzclass (url = self .url )
199201 bugid = "663674"
200202 cmd = "bugzilla modify %s " % bugid
201203
@@ -282,7 +284,7 @@ def test06ModifyEmails(self):
282284 """
283285 Modify cc, assignee, qa_contact for existing bug
284286 """
285- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
287+ bz = self .bzclass (url = self .url )
286288 bugid = "663674"
287289 cmd = "bugzilla modify %s " % bugid
288290
@@ -330,7 +332,7 @@ def test07ModifyMultiFlags(self):
330332 """
331333 Modify flags and fixed_in for 2 bugs
332334 """
333- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
335+ bz = self .bzclass (url = self .url )
334336 bugid1 = "461686"
335337 bugid2 = "461687"
336338 cmd = "bugzilla modify %s %s " % (bugid1 , bugid2 )
@@ -406,7 +408,7 @@ def cleardict(b):
406408 def test07ModifyMisc (self ):
407409 bugid = "461686"
408410 cmd = "bugzilla modify %s " % bugid
409- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
411+ bz = self .bzclass (url = self .url )
410412 bug = bz .getbug (bugid )
411413
412414 # modify --dependson
@@ -508,7 +510,7 @@ def _test8Attachments(self):
508510 """
509511 Get and set attachments for a bug
510512 """
511- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
513+ bz = self .bzclass (url = self .url )
512514 getallbugid = "663674"
513515 setbugid = "461686"
514516 cmd = "bugzilla attach "
@@ -585,7 +587,7 @@ def _test8Attachments(self):
585587
586588
587589 def test09Whiteboards (self ):
588- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
590+ bz = self .bzclass (url = self .url )
589591 bug_id = "663674"
590592 cmd = "bugzilla modify %s " % bug_id
591593 bug = bz .getbug (bug_id )
@@ -687,19 +689,9 @@ def fakegetpass(prompt):
687689 getpass .getpass = oldgetpass
688690
689691
690- def test10LoginState (self ):
691- bz = self .bzclass (url = self .url , use_creds = False )
692- self .assertFalse (bz .logged_in ,
693- "Login state check failed for logged out user." )
694-
695- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
696- self .assertTrue (bz .logged_in ,
697- "Login state check failed for logged in user." )
698-
699-
700692 def test11UserUpdate (self ):
701693 # This won't work if run by the same user we are using
702- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
694+ bz = self .bzclass (url = self .url )
703695704696 group = "fedora_contrib"
705697
@@ -761,7 +753,7 @@ def test11UserUpdate(self):
761753
762754
763755 def test11ComponentEditing (self ):
764- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
756+ bz = self .bzclass (url = self .url )
765757 component = ("python-bugzilla-testcomponent-%s" %
766758 str (random .randint (1 , 1024 * 1024 * 1024 )))
767759 basedata = {
@@ -833,11 +825,7 @@ def compare(data, newid):
833825
834826 def test12SetCookie (self ):
835827 bz = self .bzclass ("partner-bugzilla.redhat.com" ,
836- cookiefile = cf , tokenfile = None )
837-
838- fn = sys ._getframe ().f_code .co_name # pylint: disable=protected-access
839- if not self ._check_rh_privs (bz , "cookie" , fn ):
840- return
828+ cookiefile = - 1 , tokenfile = None )
841829
842830 try :
843831 bz .cookiefile = None
@@ -850,11 +838,10 @@ def test12SetCookie(self):
850838 bz .disconnect ()
851839 bz .cookiefile = None
852840 bz .connect ()
853- self .assertFalse (bool (self ._check_rh_privs (
854- bz , "" , "cookie" , quiet = True )))
841+ self .assertFalse (bz .logged_in )
855842
856843 def test13SubComponents (self ):
857- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
844+ bz = self .bzclass (url = self .url )
858845 # Long closed RHEL5 lvm2 bug. This component has sub_components
859846 bug = bz .getbug ("185526" )
860847 bug .autorefresh = True
@@ -871,13 +858,13 @@ def test13SubComponents(self):
871858 self .assertEqual (bug .sub_components , {})
872859
873860 def _deleteAllExistingExternalTrackers (self , bugid ):
874- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
861+ bz = self .bzclass (url = self .url )
875862 ids = [bug ['id' ] for bug in bz .getbug (bugid ).external_bugs ]
876863 if ids != []:
877864 bz .remove_external_tracker (ids = ids )
878865
879866 def test14ExternalTrackersQuery (self ):
880- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
867+ bz = self .bzclass (url = self .url )
881868 bugid = 461686
882869 ext_bug_id = 1234659
883870
@@ -925,7 +912,7 @@ def test14ExternalTrackersQuery(self):
925912 assert bugid in [qr .id for qr in query_results ]
926913
927914 def test14ExternalTrackersAddUpdateRemoveQuery (self ):
928- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
915+ bz = self .bzclass (url = self .url )
929916 bugid = 461686
930917 ext_bug_id = 380489
931918
@@ -973,14 +960,14 @@ def test14ExternalTrackersAddUpdateRemoveQuery(self):
973960 assert len (ids ) == 0
974961
975962 def test15EnsureLoggedIn (self ):
976- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
963+ bz = self .bzclass (url = self .url )
977964 comm = "bugzilla --ensure-logged-in query --bug_id 979546"
978965 tests .clicomm (comm , bz )
979966
980967 def test16ModifyTags (self ):
981968 bugid = "461686"
982969 cmd = "bugzilla modify %s " % bugid
983- bz = self .bzclass (url = self .url , cookiefile = cf , tokenfile = tf )
970+ bz = self .bzclass (url = self .url )
984971 bug = bz .getbug (bugid )
985972
986973 if bug .tags :
0 commit comments