Allow logging in with an API token.

Review Request #13108 — Created June 15, 2023 and updated

maubin
RBTools
release-5.x
12981
rbtools

This updates the login methods on the server and transport classes to allow
logging in to the Review Board server with either a username and password
combination or an API token.

  • Ran unit tests.
  • Tested with the upcoming web based login flow change which uses an API
    token to login.
  • Tested logging in with a username and password.
  • Tested logging out.
  • Tested passing --username and --password options to commands.
  • Tested passing --api-token option to commands.
Summary
Allow logging in with an API token.
Description From Last Updated

Let's make this a keyword-only argument. In fact, ideally, they'd all be (we can use housekeeping to deprecate old behavior). …

chipx86chipx86

We should probably put the same notice in reset().

chipx86chipx86

Looks like these None values can be removed now, right? They're all defaults.

chipx86chipx86

Let's call these with keyword arguments now, since the call's starting to get more complex and less obvious. I want …

chipx86chipx86
chipx86
  1. 
      
  2. rbtools/api/request.py (Diff revision 1)
     
     

    Let's make this a keyword-only argument. In fact, ideally, they'd all be (we can use housekeeping to deprecate old behavior).

    Same with reset(), probably.

  3. rbtools/api/request.py (Diff revision 1)
     
     
     
     
     
     

    We should probably put the same notice in reset().

  4. rbtools/api/request.py (Diff revision 1)
     
     

    Looks like these None values can be removed now, right? They're all defaults.

  5. rbtools/api/transport/sync.py (Diff revision 1)
     
     

    Let's call these with keyword arguments now, since the call's starting to get more complex and less obvious.

    I want to start using keyword-only arguments in more places to give us room to expand and change the API implementation as we grow it.

  6. 
      
maubin
maubin
Review request changed

Change Summary:

  • Updated URLMapTransport to have the api_token/username/password changes too.

Commits:

Summary
-
Allow logging in with an API token.
+
Allow logging in with an API token.

Diff:

Revision 3 (+238 -62)

Show changes

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
chipx86
  1. Looks good! Since it uses housekeeping, you'll want to wait until https://reviews.reviewboard.org/r/13124/ is landed, but otherwise, Ship It!

  2. 
      
Loading...