Skip to content

Commit a07547c

Browse files
committed
fix(client): do not assume user attrs returned for auth()
This is mostly relevant for people mocking the API in tests.
1 parent 181390a commit a07547c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitlab/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,9 @@ def auth(self) -> None:
355355
success.
356356
"""
357357
self.user = self._objects.CurrentUserManager(self).get()
358-
self._check_url(self.user.web_url, path=self.user.username)
358+
359+
if hasattr(self.user, "web_url") and hasattr(self.user, "username"):
360+
self._check_url(self.user.web_url, path=self.user.username)
359361

360362
def version(self) -> Tuple[str, str]:
361363
"""Returns the version and revision of the gitlab server.

0 commit comments

Comments
 (0)