From eeb0664a2587886ca6a9f2ec75acd02c1d576f81 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Mon, 15 Apr 2024 14:17:29 +0200 Subject: [PATCH] Fix unit test --- server/books/tests/test_chapter.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/server/books/tests/test_chapter.py b/server/books/tests/test_chapter.py index 3d424122..2bccce7f 100644 --- a/server/books/tests/test_chapter.py +++ b/server/books/tests/test_chapter.py @@ -1,31 +1,30 @@ -from books.factories import ModuleFactory, ChapterFactory -from books.models import ContentBlock, Chapter, ModulePageForm +from books.factories import ModuleFactory +from books.models import Chapter from core.tests.base_test import SkillboxTestCase from django.test.client import Client -from users.models import User class TestChapterCreation(SkillboxTestCase): - """ Test created for Issue MS-932 """ + """Test created for Issue MS-932""" + def setUp(self) -> None: self.createDefault() self.module = ModuleFactory(slug="my-module") - user = User.objects.get(username='admin') self.Client = Client() - self.client.login(username='admin', password='test') + self.client.login(username="admin", password="test") - def test_create_chapter_creates_slug_autmatically(self): - new_chapter = Chapter(title='New Chapter') + def test_create_chapter_creates_slug_automatically(self): + new_chapter = Chapter(title="New Chapter") self.module.add_child(instance=new_chapter) new_chapter.save() - self.assertEqual('new-chapter', new_chapter.slug) + self.assertEqual("new-chapter", new_chapter.slug) - def test_create_chapter_creates_slug_autmatically_if_existing(self): - new_chapter = Chapter(title='New Chapter') + def test_create_chapter_creates_slug_automatically_if_existing(self): + new_chapter = Chapter(title="New Chapter") self.module.add_child(instance=new_chapter) new_chapter.save() - self.assertEqual('new-chapter', new_chapter.slug) - new_chapter2 = Chapter(title='New Chapter') + self.assertEqual("new-chapter", new_chapter.slug) + new_chapter2 = Chapter(title="New Chapter") self.module.add_child(instance=new_chapter2) new_chapter2.save() - self.assertEqual('new-chapter-2', new_chapter2.slug) + self.assertEqual("new-chapter-2", new_chapter2.slug)