Skip to content

Commit

Permalink
Get or create Token to avoid creating existing token #224
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Jan 15, 2024
1 parent 4ecfa10 commit d97a504
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/purldb-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: Checkout code
Expand Down
1 change: 1 addition & 0 deletions matchcode_pipeline/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


class MatchCodePipelineAPITest(TransactionTestCase):
databases = {'default', 'packagedb'}
data_location = Path(__file__).parent / 'data'

def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion packagedb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,4 +1289,4 @@ def _validate_username(self, email):
def create_auth_token(sender, instance=None, created=False, **kwargs):
"""Create an API key token on user creation, using the signal system."""
if created:
Token.objects.create(user_id=instance.pk)
Token.objects.get_or_create(user_id=instance.pk)

0 comments on commit d97a504

Please sign in to comment.