stages/user_delete: fix formatting

This commit is contained in:
Jens Langhammer 2020-05-12 15:21:53 +02:00
parent e45b33c6c2
commit 57fed2b92b
7 changed files with 38 additions and 26 deletions

View file

@ -28,4 +28,3 @@ class TestUserViews(TestCase):
self.assertEqual(
self.client.get(reverse("passbook_core:user-settings")).status_code, 200
)

View file

@ -1,12 +1,9 @@
"""passbook core user views"""
from django.contrib import messages
from django.contrib.auth import logout
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.shortcuts import reverse
from django.urls import reverse_lazy
from django.utils.translation import gettext as _
from django.views.generic import DeleteView, UpdateView
from django.views.generic import UpdateView
from passbook.core.forms.users import UserDetailForm

View file

@ -6,13 +6,23 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('passbook_flows', '0004_auto_20200510_2310'),
("passbook_flows", "0004_auto_20200510_2310"),
]
operations = [
migrations.AlterField(
model_name='flow',
name='designation',
field=models.CharField(choices=[('authentication', 'Authentication'), ('invalidation', 'Invalidation'), ('enrollment', 'Enrollment'), ('unenrollment', 'Unrenollment'), ('recovery', 'Recovery'), ('password_change', 'Password Change')], max_length=100),
model_name="flow",
name="designation",
field=models.CharField(
choices=[
("authentication", "Authentication"),
("invalidation", "Invalidation"),
("enrollment", "Enrollment"),
("unenrollment", "Unrenollment"),
("recovery", "Recovery"),
("password_change", "Password Change"),
],
max_length=100,
),
),
]

View file

@ -11,7 +11,9 @@ from passbook.root.monitoring import MetricsView
LOGGER = get_logger()
admin.autodiscover()
admin.site.login = RedirectView.as_view(pattern_name="passbook_flows:default-authentication")
admin.site.login = RedirectView.as_view(
pattern_name="passbook_flows:default-authentication"
)
admin.site.logout = RedirectView.as_view(
pattern_name="passbook_flows:default-invalidate"
)

View file

@ -1,7 +1,7 @@
# Generated by Django 3.0.5 on 2020-05-12 11:59
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
@ -9,19 +9,29 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('passbook_flows', '0005_auto_20200512_1158'),
("passbook_flows", "0005_auto_20200512_1158"),
]
operations = [
migrations.CreateModel(
name='UserDeleteStage',
name="UserDeleteStage",
fields=[
('stage_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='passbook_flows.Stage')),
(
"stage_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="passbook_flows.Stage",
),
),
],
options={
'verbose_name': 'User Delete Stage',
'verbose_name_plural': 'User Delete Stages',
"verbose_name": "User Delete Stage",
"verbose_name_plural": "User Delete Stages",
},
bases=('passbook_flows.stage',),
bases=("passbook_flows.stage",),
),
]

View file

@ -1,11 +1,10 @@
"""Delete stage logic"""
from django.contrib import messages
from django.contrib.auth.backends import ModelBackend
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from django.views.generic import FormView
from structlog import get_logger
from django.views.generic import FormView
from passbook.core.models import User
from passbook.flows.planner import PLAN_CONTEXT_PENDING_USER
from passbook.flows.stage import AuthenticationStage

View file

@ -1,7 +1,4 @@
"""delete tests"""
import string
from random import SystemRandom
from django.shortcuts import reverse
from django.test import Client, TestCase
@ -9,8 +6,6 @@ from passbook.core.models import User
from passbook.flows.models import Flow, FlowDesignation, FlowStageBinding
from passbook.flows.planner import PLAN_CONTEXT_PENDING_USER, FlowPlan
from passbook.flows.views import SESSION_KEY_PLAN
from passbook.stages.prompt.stage import PLAN_CONTEXT_PROMPT
from passbook.stages.user_delete.forms import UserDeleteStageForm
from passbook.stages.user_delete.models import UserDeleteStage
@ -19,7 +14,7 @@ class TestUserDeleteStage(TestCase):
def setUp(self):
super().setUp()
self.username = 'qerqwerqrwqwerwq'
self.username = "qerqwerqrwqwerwq"
self.user = User.objects.create(username=self.username, email="test@beryju.org")
self.client = Client()
@ -58,7 +53,7 @@ class TestUserDeleteStage(TestCase):
reverse(
"passbook_flows:flow-executor", kwargs={"flow_slug": self.flow.slug}
),
{}
{},
)
self.assertEqual(response.status_code, 302)
self.assertFalse(User.objects.filter(username=self.username).exists())