Skip to content

Commit

Permalink
[webkitbugspy] Support radar users with no username
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=247145
rdar://101645349

Reviewed by Aakash Jain.

* Tools/Scripts/libraries/webkitbugspy/setup.py: Bump verison.
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/radar.py:
(Tracker.user):
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/tests/radar_unittest.py:
(TestRadar.test_users):

Canonical link: https://commits.webkit.org/256105@main
  • Loading branch information
JonWBedard committed Oct 28, 2022
1 parent 0abef5e commit 3fca3f4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Tools/Scripts/libraries/webkitbugspy/setup.py
Expand Up @@ -30,7 +30,7 @@ def readme():

setup(
name='webkitbugspy',
version='0.8.3',
version='0.8.4',
description='Library containing a shared API for various bug trackers.',
long_description=readme(),
classifiers=[
Expand Down
Expand Up @@ -46,7 +46,7 @@ def _maybe_add_library_path(path):
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)

version = Version(0, 8, 3)
version = Version(0, 8, 4)

from .user import User
from .issue import Issue
Expand Down
8 changes: 5 additions & 3 deletions Tools/Scripts/libraries/webkitbugspy/webkitbugspy/radar.py
Expand Up @@ -148,9 +148,11 @@ def user(self, name=None, username=None, email=None):
elif name:
found = self.library.AppleDirectoryQuery.user_entry_for_attribute_value('cn', name)
if not found:
raise RuntimeError("Failed to find '{}'".format(User(
name, username, [email],
)))
return self.users.create(
name=name,
username=None,
emails=[email],
)
name = '{} {}'.format(found.first_name(), found.last_name())
username = found.dsid()
email = found.email()
Expand Down
Expand Up @@ -60,6 +60,10 @@ def test_users(self):
User.Encoder().default(tracker.user(name='Felix Filer')),
dict(name='Felix Filer', username=809, emails=['ffiler@example.com']),
)
self.assertEqual(
User.Encoder().default(tracker.user(name='Olivia Outsider', email='ooutsider@example.com')),
dict(name='Olivia Outsider', emails=['ooutsider@example.com']),
)

def test_link(self):
with mocks.Radar(users=mocks.USERS):
Expand Down

0 comments on commit 3fca3f4

Please sign in to comment.