Skip to content

Commit 45e1458

Browse files
committed
tests: rw: Add api_key test
Needs bugzilla 5 Suggested-by: Peter Wu <[email protected]>
1 parent da66662 commit 45e1458

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/rw_functional.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,3 +959,17 @@ def test16ModifyTags(self):
959959
bz.update_tags(bug.id, tags_remove=bug.tags)
960960
bug.refresh()
961961
self.assertEqual(bug.tags, [])
962+
963+
def test17LoginAPIKey(self):
964+
api_key = "somefakeapikey1234"
965+
bz = self.bzclass(url=self.url, use_creds=False, api_key=api_key)
966+
if bz.bz_ver_major < 5:
967+
self.skipTest("can only test apikey on bugzilla 5+")
968+
969+
try:
970+
self.assertTrue(bz.logged_in, False)
971+
972+
# Use this to trigger a warning about api_key
973+
bz.createbug(bz.build_createbug())
974+
except Exception as e:
975+
self.assertTrue("The API key you specified is invalid" in str(e))

0 commit comments

Comments
 (0)