Skip to content

Commit a20a8b6

Browse files
committed
README and unit tests for humans
1 parent a409297 commit a20a8b6

File tree

6 files changed

+76
-2
lines changed

6 files changed

+76
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
db.sqlite3
12
.tox/
23
*.pyc
34
*.egg-info

README.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,18 @@ following url::
545545
Now if you go to the /test/ url you will see your SAML attributes and also
546546
a link to do a global logout.
547547

548-
You can also run the unit tests with the following command::
548+
Unit tests
549+
==========
549550

551+
You can also run the unit tests as follows::
552+
553+
pip install -r requirements-dev.txt
554+
python3 tests/manage.py migrate
555+
550556
python tests/run_tests.py
557+
# or
558+
pytest tests/* -x --pdb
559+
551560

552561
If you have `tox`_ installed you can simply call tox inside the root directory
553562
and it will run the tests in multiple versions of Python.

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pytest
2+
pytest-django

tests/settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
ALLOWED_HOSTS = []
2626

2727
INSTALLED_APPS = (
28+
#'accounts',
29+
'testprofiles',
30+
2831
'django.contrib.admin',
2932
'django.contrib.auth',
3033
'django.contrib.contenttypes',
@@ -33,7 +36,6 @@
3336
'django.contrib.staticfiles',
3437

3538
'djangosaml2',
36-
'testprofiles',
3739
)
3840

3941
MIDDLEWARE = (
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Generated by Django 3.0.5 on 2020-05-01 14:54
2+
3+
import django.contrib.auth.models
4+
import django.contrib.auth.validators
5+
from django.db import migrations, models
6+
import django.utils.timezone
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
initial = True
12+
13+
dependencies = [
14+
('auth', '0011_update_proxy_permissions'),
15+
]
16+
17+
operations = [
18+
migrations.CreateModel(
19+
name='RequiredFieldUser',
20+
fields=[
21+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22+
('email', models.EmailField(max_length=254, unique=True)),
23+
('email_verified', models.BooleanField()),
24+
],
25+
),
26+
migrations.CreateModel(
27+
name='StandaloneUserModel',
28+
fields=[
29+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
30+
('username', models.CharField(max_length=30, unique=True)),
31+
],
32+
),
33+
migrations.CreateModel(
34+
name='TestUser',
35+
fields=[
36+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
37+
('password', models.CharField(max_length=128, verbose_name='password')),
38+
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
39+
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
40+
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
41+
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
42+
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
43+
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
44+
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
45+
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
46+
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
47+
('age', models.CharField(blank=True, max_length=100)),
48+
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
49+
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
50+
],
51+
options={
52+
'verbose_name': 'user',
53+
'verbose_name_plural': 'users',
54+
'abstract': False,
55+
},
56+
managers=[
57+
('objects', django.contrib.auth.models.UserManager()),
58+
],
59+
),
60+
]

tests/testprofiles/migrations/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)