Commit 50f6293a authored by Robert's avatar Robert

Added tests

parent 63848d8c
Pipeline #1245 failed with stage
in 11 minutes and 44 seconds
......@@ -2,7 +2,6 @@ import django.views.generic.edit
from django.utils.timezone import now
import core
import features
from features.associations.views import AssociationMixin
from . import models
......
......@@ -92,13 +92,13 @@ class Gestalt(core.models.Model):
data = {}
data['gestalt'] = self
data['user'] = self.user
#data['groups_created'] = ?
# data['groups_created'] = ?
data['memberships'] = self.memberships
data['subscriptions'] = self.subscriptions
data['tokens'] = self.permissiontoken_set
data['settings'] = self.gestaltsetting_set
data['associations'] = self.associations
data['contributions'] = self.contributions
data['images'] = self.images
......
......@@ -28,8 +28,10 @@
<li>{{ view.data.votes.count }} Stimmen in Umfragen</li>
</ul>
<p>Solltest Du damit nicht einverstanden sein, führe diesen Schritt bitte nicht aus sondern
<a href="{% url 'create-group-conversation' about_group.pk %}">schreib uns stattdessen eine Nachricht</a>.</p>
{% if about_group %}
<p>Solltest Du damit nicht einverstanden sein, führe diesen Schritt bitte nicht aus sondern
<a href="{% url 'create-group-conversation' about_group.pk %}">schreib uns stattdessen eine Nachricht</a>.</p>
{% endif %}
<button class="btn btn-danger">
Benutzerkonto löschen
......
......@@ -2,6 +2,8 @@ from django.contrib import auth
from django.urls import reverse
from django.test import TestCase
from . import models
class GestaltMixin:
@classmethod
......@@ -62,6 +64,10 @@ class Settings(TestCase):
class AuthenticatedSettings(AuthenticatedMixin, TestCase):
def setUp(self):
auth.get_user_model().objects.create(email='unknown@example.org', username='unknown')
super().setUp()
def test_authenticated_settings(self):
# general settings accessible
r = self.client.get('/')
......@@ -90,3 +96,14 @@ class AuthenticatedSettings(AuthenticatedMixin, TestCase):
self.assertEqual(r.status_code, 200)
r = self.client.get(password_settings_url)
self.assertEqual(r.status_code, 302)
def test_delete(self):
delete_url = reverse('delete-gestalt')
r = self.client.get(reverse('settings'))
self.assertContains(r, 'href="{}'.format(delete_url))
r = self.client.get(delete_url)
self.assertEqual(r.status_code, 200)
r = self.client.post(delete_url)
self.assertRedirects(r, '/')
self.assertFalse(models.Gestalt.objects.filter(pk=self.gestalt.pk).exists())
......@@ -3,7 +3,6 @@ import django
from allauth.account import views
from allauth.account import views as allauth_views
from crispy_forms import layout
from django.conf import settings
from django.urls import reverse
from django.views import generic
from django.views.generic import edit as edit_views, DeleteView, UpdateView
......
......@@ -5,3 +5,4 @@ DATABASES = {
'ENGINE': 'django.db.backends.sqlite3',
}
}
GROUPRISE_UNKNOWN_GESTALT_ID = 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment