Skip to content

Commit c50c7de

Browse files
committed
test app using username and tests
1 parent a628b67 commit c50c7de

File tree

1,608 files changed

+39969
-59
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,608 files changed

+39969
-59
lines changed
+43-59
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,44 @@
11
from django.test import RequestFactory, TransactionTestCase, Client
2-
3-
4-
# class test_passkeys(TransactionTestCase):
5-
# def setUp(self) -> None:
6-
# from django.contrib.auth import get_user_model
7-
8-
# if not getattr(self, "assertEquals", None):
9-
# self.assertEquals = self.assertEqual
10-
11-
# self.user_model = get_user_model()
12-
# self.user = self.user_model.objects.create_user(
13-
# username="test", password="test"
14-
# )
15-
# self.client = Client()
16-
# self.factory = RequestFactory()
17-
18-
# def test_raiseException(self):
19-
# from django.contrib.auth import authenticate
20-
21-
# try:
22-
# authenticate(request=None, username="test", password="test")
23-
# self.assertFalse(True)
24-
# except Exception as e:
25-
# self.assertEquals(
26-
# str(e), "request is required for passkeys.backend.PasskeyModelBackend"
27-
# )
28-
29-
# def test_not_add_passkeys_field(self):
30-
# request = self.factory.post("/auth/login", {"username": "", "password": ""})
31-
# from django.contrib.auth import authenticate
32-
33-
# try:
34-
# user = authenticate(request=request, username="", password="")
35-
# self.assertFalse(True)
36-
# except Exception as e:
37-
# self.assertEquals(
38-
# str(e),
39-
# "Can't find 'passkeys' key in request.POST, did you add the hidden input?",
40-
# )
41-
42-
# def test_username_password_failed_login(self):
43-
# self.client.post(
44-
# "/passkeys/login",
45-
# {"username": "test", "password": "test123", "passkeys": ""},
46-
# )
47-
# self.assertFalse(self.client.session.get("_auth_user_id", False))
48-
49-
# def test_username_password_login(self):
50-
# self.client.post(
51-
# "/passkeys/login", {"username": "test", "password": "test", "passkeys": ""}
52-
# )
53-
# self.assertTrue(self.client.session.get("_auth_user_id", False))
54-
# self.assertFalse(self.client.session.get("passkey", {}).get("passkey", False))
55-
56-
# def test_no_data(self):
57-
# self.client.post(
58-
# "/passkeys/login", {"username": "", "password": "", "passkeys": ""}
59-
# )
60-
# self.assertFalse(self.client.session.get("_auth_user_id", False))
2+
from django.urls import reverse
3+
4+
class test_passkeys(TransactionTestCase):
5+
def setUp(self) -> None:
6+
from django.contrib.auth import get_user_model
7+
8+
if not getattr(self, "assertEquals", None):
9+
self.assertEquals = self.assertEqual
10+
11+
self.user_model = get_user_model()
12+
self.user = self.user_model.objects.create_user(
13+
username="test", password="test"
14+
)
15+
self.client = Client()
16+
self.factory = RequestFactory()
17+
18+
def test_raiseException(self):
19+
from django.contrib.auth import authenticate
20+
21+
try:
22+
authenticate(request=None, username="test", password="test")
23+
except Exception as e:
24+
self.assertEquals(
25+
str(e), "request is required for passkeys.backend.PasskeyModelBackend"
26+
)
27+
28+
def test_not_add_passkeys_field(self):
29+
request = self.factory.post("/auth/login", {"username": "", "password": ""})
30+
from django.contrib.auth import authenticate
31+
32+
try:
33+
authenticate(request=request, username="", password="")
34+
except Exception as e:
35+
self.assertEquals(
36+
str(e),
37+
"Can't find 'passkeys' key in request.POST, did you add the hidden input?",
38+
)
39+
40+
def test_no_data(self):
41+
self.client.post(
42+
reverse("passkeys:login"), {"username": "", "password": "", "passkeys": ""}
43+
)
44+
self.assertFalse(self.client.session.get("_auth_user_id", False))

example_username/.coveragerc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[run]
2+
omit =
3+
*/tests/*
4+
*/migrations/*
5+
include=
6+
*/passkeys/*
7+
test_app/*
8+
9+
[report]
10+
skip_covered = True
11+
show_missing = True
12+
omit =
13+
*/tests/*
14+
*/migrations/*
15+
test_app/soft_webauthn.py
16+
include=
17+
*/passkeys/*
18+
test_app/*

example_username/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
django-sslserver

example_username/manage.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_app.settings")
7+
try:
8+
from django.core.management import execute_from_command_line
9+
except ImportError as exc:
10+
raise ImportError(
11+
"Couldn't import Django. Are you sure it's installed and "
12+
"available on your PYTHONPATH environment variable? Did you "
13+
"forget to activate a virtual environment?"
14+
) from exc
15+
execute_from_command_line(sys.argv)

example_username/static/css/sb-admin.min.css

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
(function($) {
2+
"use strict"; // Start of use strict
3+
4+
// Toggle the side navigation
5+
$("#sidebarToggle").on('click', function(e) {
6+
e.preventDefault();
7+
$("body").toggleClass("sidebar-toggled");
8+
$(".sidebar").toggleClass("toggled");
9+
});
10+
11+
// Prevent the content wrapper from scrolling when the fixed side navigation hovered over
12+
$('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) {
13+
if ($(window).width() > 768) {
14+
var e0 = e.originalEvent,
15+
delta = e0.wheelDelta || -e0.detail;
16+
this.scrollTop += (delta < 0 ? 1 : -1) * 30;
17+
e.preventDefault();
18+
}
19+
});
20+
21+
// Scroll to top button appear
22+
$(document).on('scroll', function() {
23+
var scrollDistance = $(this).scrollTop();
24+
if (scrollDistance > 100) {
25+
$('.scroll-to-top').fadeIn();
26+
} else {
27+
$('.scroll-to-top').fadeOut();
28+
}
29+
});
30+
31+
// Smooth scrolling using jQuery easing
32+
$(document).on('click', 'a.scroll-to-top', function(event) {
33+
var $anchor = $(this);
34+
$('html, body').stop().animate({
35+
scrollTop: ($($anchor.attr('href')).offset().top)
36+
}, 1000, 'easeInOutExpo');
37+
event.preventDefault();
38+
});
39+
40+
})(jQuery); // End of use strict

example_username/static/js/sb-admin.min.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*! ========================================================================
2+
* Bootstrap Toggle: bootstrap-toggle.css v2.2.0
3+
* http://www.bootstraptoggle.com
4+
* ========================================================================
5+
* Copyright 2014 Min Hur, The New York Times Company
6+
* Licensed under MIT
7+
* ======================================================================== */
8+
.checkbox label .toggle,.checkbox-inline .toggle{margin-left:-20px;margin-right:5px}
9+
.toggle{position:relative;overflow:hidden}
10+
.toggle input[type=checkbox]{display:none}
11+
.toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;-moz-user-select:none;-webkit-user-select:none}
12+
.toggle.off .toggle-group{left:-100%}
13+
.toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0}
14+
.toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0}
15+
.toggle-handle{position:relative;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px}
16+
.toggle.btn{min-width:59px;min-height:34px}
17+
.toggle-on.btn{padding-right:24px}
18+
.toggle-off.btn{padding-left:24px}
19+
.toggle.btn-lg{min-width:79px;min-height:45px}
20+
.toggle-on.btn-lg{padding-right:31px}
21+
.toggle-off.btn-lg{padding-left:31px}
22+
.toggle-handle.btn-lg{width:40px}
23+
.toggle.btn-sm{min-width:50px;min-height:30px}
24+
.toggle-on.btn-sm{padding-right:20px}
25+
.toggle-off.btn-sm{padding-left:20px}
26+
.toggle.btn-xs{min-width:35px;min-height:22px}
27+
.toggle-on.btn-xs{padding-right:12px}
28+
.toggle-off.btn-xs{padding-left:12px}

example_username/static/mfa/js/bootstrap-toggle.min.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example_username/static/vendor/bootstrap/js/bootstrap.bundle.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example_username/static/vendor/bootstrap/js/bootstrap.bundle.min.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example_username/static/vendor/bootstrap/js/bootstrap.bundle.min.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example_username/static/vendor/bootstrap/js/bootstrap.min.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example_username/static/vendor/bootstrap/js/bootstrap.min.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Font Awesome Free License
2+
-------------------------
3+
4+
Font Awesome Free is free, open source, and GPL friendly. You can use it for
5+
commercial projects, open source projects, or really almost whatever you want.
6+
Full Font Awesome Free license: https://fontawesome.com/license/free.
7+
8+
# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
9+
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
10+
packaged as SVG and JS file types.
11+
12+
# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
13+
In the Font Awesome Free download, the SIL OFL license applies to all icons
14+
packaged as web and desktop font files.
15+
16+
# Code: MIT License (https://opensource.org/licenses/MIT)
17+
In the Font Awesome Free download, the MIT license applies to all non-font and
18+
non-icon files.
19+
20+
# Attribution
21+
Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
22+
Awesome Free files already contain embedded comments with sufficient
23+
attribution, so you shouldn't need to do anything additional when using these
24+
files normally.
25+
26+
We've kept attribution comments terse, so we ask that you do not actively work
27+
to remove them from files, especially code. They're a great way for folks to
28+
learn about Font Awesome.
29+
30+
# Brand Icons
31+
All brand icons are trademarks of their respective owners. The use of these
32+
trademarks does not indicate endorsement of the trademark holder by Font
33+
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
34+
to represent the company, product, or service to which they refer.**

example_username/static/vendor/fontawesome-free/css/all.min.css

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)