Skip to content

Commit cdc6ee8

Browse files
committed
Adopt new dependency which comes with template
1 parent 2c5859b commit cdc6ee8

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

mysite/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import os, random, string
1515
from dotenv import load_dotenv
16-
from ms_identity_python.django import Auth # pip install "ms_identity_python[django] @ git+https://github.com/azure-samples/[email protected]"
16+
from identity.django import Auth
1717
load_dotenv()
1818
AUTH = Auth(
1919
os.getenv('CLIENT_ID'),

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
ms_identity_python[django] @ git+https://github.com/azure-samples/ms-identity-python@0.8
1+
ms_identity_python[django] @ https://github.com/azure-samples/ms-identity-python/archive/refs/heads/0.9.zip
22
python-dotenv<0.22
33
requests>=2,<3

tests/__init__.py

Whitespace-only changes.

tests/test_views.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from django.test import TestCase
2+
from django.template.exceptions import TemplateDoesNotExist
3+
4+
5+
class TemplateAccessibilityTest(TestCase):
6+
def test_login_attempt_should_render_its_template(self):
7+
try:
8+
response = self.client.get("/") # It will trigger the login attempt
9+
print(response.content)
10+
# The response could be rendered by login.html if .env is complete,
11+
# or by auth_error.html otherwise.
12+
# I haven't figured out how to mock the .env to test it decisively.
13+
except TemplateDoesNotExist:
14+
self.fail(
15+
"Template should be accessible, "
16+
"typically came from inside the Identity package.")
17+

tox.ini

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[tox]
2+
env_list =
3+
py3
4+
minversion = 4.21.2
5+
6+
[testenv]
7+
description = run the tests with pytest
8+
package = wheel
9+
wheel_build_env = .pkg
10+
deps =
11+
pytest>=6
12+
-r requirements.txt
13+
skip_install = true # To bypass the error "Multiple top-level packages discovered"
14+
commands =
15+
pip list
16+
python manage.py test
17+

0 commit comments

Comments
 (0)