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

Contributor backend 21 #32

Merged
merged 21 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ name = "pypi"
# 5. Run `pipenv install --dev` in your terminal.

[packages]
codeforlife = {ref = "v0.20.0", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
codeforlife = {ref = "v0.21.0", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
# 🚫 Don't add [packages] below that are inherited from the CFL package.

[dev-packages]
codeforlife = {ref = "v0.20.0", git = "https://github.com/ocadotechnology/codeforlife-package-python.git", extras = ["dev"]}
codeforlife = {ref = "v0.21.0", git = "https://github.com/ocadotechnology/codeforlife-package-python.git", extras = ["dev"]}
# codeforlife = {file = "../codeforlife-package-python", editable = true, extras = ["dev"]}
# 🚫 Don't add [dev-packages] below that are inherited from the CFL package.

Expand Down
6 changes: 3 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions api/auth/backends/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
import typing as t

import requests
from codeforlife.request import HttpRequest
from codeforlife.request import BaseHttpRequest
from codeforlife.types import JsonDict
from django.conf import settings
from django.contrib.auth.backends import BaseBackend

from ...models import Contributor
from ...models.session import SessionStore


class GitHubBackend(BaseBackend):
"""Authenticate a user using the code returned by github's callback url."""

def authenticate( # type: ignore[override]
self,
request: t.Optional[HttpRequest],
request: t.Optional[BaseHttpRequest[SessionStore, Contributor]],
code: t.Optional[str] = None,
**kwargs,
):
Expand Down
5 changes: 3 additions & 2 deletions api/auth/backends/github_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
from unittest.mock import Mock, patch

import requests
from codeforlife.request import HttpRequest
from codeforlife.request import BaseHttpRequest
from codeforlife.tests import TestCase
from django.conf import settings
from rest_framework import status

from ...models import Contributor
from ...models.session import SessionStore
from .github import GitHubBackend


Expand All @@ -24,7 +25,7 @@ def setUp(self):
# Set up initial test data
self.contributor1 = Contributor.objects.get(id=1)
self.backend = GitHubBackend()
self.request = HttpRequest()
self.request = BaseHttpRequest[SessionStore, Contributor]()

self.gh_access_token_response = requests.Response()
self.gh_access_token_response.status_code = status.HTTP_200_OK
Expand Down
10 changes: 0 additions & 10 deletions api/common/__init__.py

This file was deleted.

212 changes: 0 additions & 212 deletions api/common/api_request_factory.py

This file was deleted.

53 changes: 0 additions & 53 deletions api/common/model_serializer.py

This file was deleted.

Loading
Loading