Fix JWT test by JonnyWong16 · Pull Request #1582 · pushingkarmaorg/python-plexapi

Pull request overview

This PR updates the JWT login test and slightly adjusts keypair generation to align with the latest MyPlex JWT implementation from #1577.

Changes:

  • Update test_myplex_jwt_login to use a real MyPlexDevice, verify accounts via username instead of object equality, and strengthen coverage around multi-JWK verification and invalid-signature behavior.
  • Refactor MyPlexJWTLogin.generateKeypair to write key bytes via local variables and then assign them to instance attributes, keeping behavior consistent while making the in-memory key handling clearer.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/test_myplex.py Adjusts the JWT login test to create a dedicated MyPlexDevice, verify JWT-derived accounts via username, and more precisely exercise _getPlexPublicJWK behavior with valid and invalid JWKs.
plexapi/myplex.py Updates MyPlexJWTLogin.generateKeypair to generate key bytes once, write them to files if requested, then assign them to _privateKey/_publicKey, preserving expected behavior and avoiding partially-updated instance state on FileExistsError.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.