Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync NamedUser class with API spec #3149

Merged
merged 8 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update test assertions
  • Loading branch information
EnricoMi committed Jan 8, 2025
commit 0ee5ee031b1aebca43e82559985fa03b4560ad01
74 changes: 43 additions & 31 deletions tests/NamedUser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,48 +49,60 @@ def setUp(self):
self.user = self.g.get_user("jacquev6")

def testAttributes(self):
self.assertEqual(
self.user.avatar_url,
"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
)
self.assertEqual(self.user.bio, "")
self.assertEqual(self.user.avatar_url, "https://avatars.githubusercontent.com/u/327146?v=4")
self.assertIsNone(self.user.bio)
self.assertEqual(self.user.blog, "http://vincent-jacques.net")
self.assertEqual(self.user.collaborators, 0)
self.assertEqual(self.user.company, "Criteo")
self.assertEqual(
self.user.created_at,
datetime(2010, 7, 9, 6, 10, 6, tzinfo=timezone.utc),
)
self.assertEqual(self.user.disk_usage, 17080)
self.assertIsNone(self.user.collaborators)
self.assertIsNone(self.user.company)
self.assertIsNone(self.user.contributions)
self.assertEqual(self.user.created_at, datetime(2010, 7, 9, 6, 10, 6, tzinfo=timezone.utc))
self.assertIsNone(self.user.disk_usage)
self.assertIsNone(self.user.display_login)
self.assertEqual(self.user.email, "[email protected]")
self.assertEqual(self.user.followers, 13)
self.assertEqual(self.user.following, 24)
self.assertEqual(self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225")
self.assertFalse(self.user.hireable)
self.assertEqual(self.user.events_url, 'https://api.github.com/users/jacquev6/events{/privacy}')
self.assertEqual(self.user.followers, 98)
self.assertEqual(self.user.followers_url, 'https://api.github.com/users/jacquev6/followers')
self.assertEqual(self.user.following, 62)
self.assertEqual(self.user.following_url, 'https://api.github.com/users/jacquev6/following{/other_user}')
self.assertEqual(self.user.gists_url, 'https://api.github.com/users/jacquev6/gists{/gist_id}')
self.assertEqual(self.user.gravatar_id, '')
self.assertTrue(self.user.hireable)
self.assertEqual(self.user.html_url, "https://github.com/jacquev6")
self.assertEqual(self.user.id, 327146)
self.assertEqual(self.user.location, "Paris, France")
self.assertEqual(self.user.location, 'France')
self.assertEqual(self.user.login, "jacquev6")
self.assertEqual(self.user.name, "Vincent Jacques")
self.assertEqual(self.user.owned_private_repos, 5)
self.assertEqual(self.user.plan.name, "micro")
self.assertEqual(self.user.plan.collaborators, 1)
self.assertEqual(self.user.plan.space, 614400)
self.assertEqual(self.user.plan.private_repos, 5)
self.assertEqual(self.user.private_gists, 5)
self.assertEqual(self.user.public_gists, 2)
self.assertEqual(self.user.public_repos, 11)
self.assertEqual(
self.user.suspended_at,
datetime(2013, 8, 10, 7, 11, 7, tzinfo=timezone.utc),
)
self.assertEqual(self.user.total_private_repos, 5)
self.assertEqual(self.user.node_id, 'MDQ6VXNlcjMyNzE0Ng==')
self.assertIsNone(self.user.notification_email)
self.assertEqual(self.user.organizations_url, 'https://api.github.com/users/jacquev6/orgs')
self.assertIsNone(self.user.owned_private_repos)
self.assertIsNone(self.user.permissions)
self.assertIsNone(self.user.plan)
self.assertIsNone(self.user.plan)
self.assertIsNone(self.user.plan)
self.assertIsNone(self.user.plan)
self.assertIsNone(self.user.private_gists)
self.assertEqual(self.user.public_gists, 18)
self.assertEqual(self.user.public_repos, 38)
self.assertEqual(self.user.received_events_url, 'https://api.github.com/users/jacquev6/received_events')
self.assertEqual(self.user.repos_url, 'https://api.github.com/users/jacquev6/repos')
self.assertIsNone(self.user.role_name)
self.assertEqual(self.user.score, None)
self.assertEqual(self.user.site_admin, False)
self.assertIsNone(self.user.starred_at)
self.assertEqual(self.user.starred_url, 'https://api.github.com/users/jacquev6/starred{/owner}{/repo}')
self.assertEqual(self.user.subscriptions_url, 'https://api.github.com/users/jacquev6/subscriptions')
self.assertIsNone(self.user.suspended_at)
self.assertIsNone(self.user.text_matches)
self.assertIsNone(self.user.total_private_repos)
self.assertIsNone(self.user.twitter_username)
self.assertEqual(self.user.type, "User")
self.assertEqual(self.user.updated_at, datetime(2024, 10, 20, 7, 14, 52, tzinfo=timezone.utc))
self.assertEqual(self.user.url, "https://api.github.com/users/jacquev6")
self.assertEqual(self.user.node_id, "MDQ6VXNlcjMyNzE0Ng==")
self.assertEqual(repr(self.user), 'NamedUser(login="jacquev6")')
self.assertEqual(repr(self.user.plan), 'Plan(name="micro")')
self.assertEqual(repr(self.user.plan), 'None')
self.assertEqual(self.user.user_view_type, 'public')

def testAttributesOfOtherUser(self):
self.user = self.g.get_user("nvie")
Expand Down