diff --git a/api/serializers.py b/api/serializers.py index 8554867d..23c46fe6 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -227,7 +227,10 @@ class TimerSerializer(CoreModelSerializer): required=False, ) user = serializers.PrimaryKeyRelatedField( - allow_null=True, allow_empty=True, queryset=get_user_model().objects.all(), required=False + allow_null=True, + allow_empty=True, + queryset=get_user_model().objects.all(), + required=False, ) class Meta: diff --git a/babybuddy/management/commands/migrate.py b/babybuddy/management/commands/migrate.py index a0c6e2cf..f692a390 100644 --- a/babybuddy/management/commands/migrate.py +++ b/babybuddy/management/commands/migrate.py @@ -11,7 +11,9 @@ class Command(migrate.Command): superusers = get_user_model().objects.filter(is_superuser=True) if len(superusers) == 0: - default_user = get_user_model().objects.create_user("admin", password="admin") + default_user = get_user_model().objects.create_user( + "admin", password="admin" + ) default_user.is_superuser = True default_user.is_staff = True default_user.save() diff --git a/babybuddy/tests/tests_commands.py b/babybuddy/tests/tests_commands.py index 36c4ce7b..fac66af6 100644 --- a/babybuddy/tests/tests_commands.py +++ b/babybuddy/tests/tests_commands.py @@ -9,7 +9,9 @@ from core.models import Child class CommandsTestCase(TransactionTestCase): def test_migrate(self): call_command("migrate", verbosity=0) - self.assertIsInstance(get_user_model().objects.get(username="admin"), get_user_model()) + self.assertIsInstance( + get_user_model().objects.get(username="admin"), get_user_model() + ) def test_fake(self): call_command("migrate", verbosity=0) @@ -20,7 +22,9 @@ class CommandsTestCase(TransactionTestCase): def test_reset(self): call_command("reset", verbosity=0, interactive=False) - self.assertIsInstance(get_user_model().objects.get(username="admin"), get_user_model()) + self.assertIsInstance( + get_user_model().objects.get(username="admin"), get_user_model() + ) self.assertEqual(Child.objects.count(), 1) def test_createuser(self): @@ -31,9 +35,13 @@ class CommandsTestCase(TransactionTestCase): password="test", verbosity=0, ) - self.assertIsInstance(get_user_model().objects.get(username="test"), get_user_model()) + self.assertIsInstance( + get_user_model().objects.get(username="test"), get_user_model() + ) self.assertFalse( - get_user_model().objects.filter(username="test", is_staff=True, is_superuser=True) + get_user_model().objects.filter( + username="test", is_staff=True, is_superuser=True + ) ) call_command( "createuser", @@ -43,7 +51,11 @@ class CommandsTestCase(TransactionTestCase): password="test", verbosity=0, ) - self.assertIsInstance(get_user_model().objects.get(username="testadmin"), get_user_model()) - self.assertTrue( - get_user_model().objects.filter(username="testadmin", is_staff=True, is_superuser=True) + self.assertIsInstance( + get_user_model().objects.get(username="testadmin"), get_user_model() + ) + self.assertTrue( + get_user_model().objects.filter( + username="testadmin", is_staff=True, is_superuser=True + ) ) diff --git a/babybuddy/tests/tests_forms.py b/babybuddy/tests/tests_forms.py index 1ab24a0d..e87e8c65 100644 --- a/babybuddy/tests/tests_forms.py +++ b/babybuddy/tests/tests_forms.py @@ -24,7 +24,9 @@ class FormsTestCase(TestCase): "username": fake_user["username"], "password": fake.password(), } - cls.user = get_user_model().objects.create_user(is_superuser=True, **cls.credentials) + cls.user = get_user_model().objects.create_user( + is_superuser=True, **cls.credentials + ) cls.settings_template = { "first_name": "User", @@ -95,7 +97,9 @@ class FormsTestCase(TestCase): page = self.c.post("/users/{}/delete/".format(new_user.id)) self.assertEqual(page.status_code, 302) - self.assertQuerysetEqual(get_user_model().objects.filter(username="username"), []) + self.assertQuerysetEqual( + get_user_model().objects.filter(username="username"), [] + ) def test_user_settings(self): self.c.login(**self.credentials) @@ -110,7 +114,9 @@ class FormsTestCase(TestCase): def test_user_regenerate_api_key(self): self.c.login(**self.credentials) - api_key_before = get_user_model().objects.get(pk=self.user.id).settings.api_key() + api_key_before = ( + get_user_model().objects.get(pk=self.user.id).settings.api_key() + ) params = self.settings_template.copy() params["api_key_regenerate"] = "Regenerate" diff --git a/core/tests/tests_forms.py b/core/tests/tests_forms.py index 61b8dfca..bd958cd0 100644 --- a/core/tests/tests_forms.py +++ b/core/tests/tests_forms.py @@ -26,7 +26,9 @@ class FormsTestCaseBase(TestCase): fake_user = fake.simple_profile() credentials = {"username": fake_user["username"], "password": fake.password()} - cls.user = get_user_model().objects.create_user(is_superuser=True, **credentials) + cls.user = get_user_model().objects.create_user( + is_superuser=True, **credentials + ) cls.c.login(**credentials) cls.child = models.Child.objects.create( diff --git a/core/tests/tests_views.py b/core/tests/tests_views.py index e4a78681..3a0ea1a0 100644 --- a/core/tests/tests_views.py +++ b/core/tests/tests_views.py @@ -25,7 +25,9 @@ class ViewsTestCase(TestCase): "username": fake_user["username"], "password": fake.password(), } - cls.user = get_user_model().objects.create_user(is_superuser=True, **cls.credentials) + cls.user = get_user_model().objects.create_user( + is_superuser=True, **cls.credentials + ) cls.c.login(**cls.credentials) diff --git a/dashboard/tests/tests_views.py b/dashboard/tests/tests_views.py index d88088b8..dd6d97df 100644 --- a/dashboard/tests/tests_views.py +++ b/dashboard/tests/tests_views.py @@ -23,7 +23,9 @@ class ViewsTestCase(TestCase): "username": fake_user["username"], "password": fake.password(), } - cls.user = get_user_model().objects.create_user(is_superuser=True, **cls.credentials) + cls.user = get_user_model().objects.create_user( + is_superuser=True, **cls.credentials + ) cls.c.login(**cls.credentials) diff --git a/reports/tests/tests_views.py b/reports/tests/tests_views.py index 4f65304b..b2fdec7d 100644 --- a/reports/tests/tests_views.py +++ b/reports/tests/tests_views.py @@ -24,7 +24,9 @@ class ViewsTestCase(TestCase): "username": fake_user["username"], "password": fake.password(), } - cls.user = get_user_model().objects.create_user(is_superuser=True, **cls.credentials) + cls.user = get_user_model().objects.create_user( + is_superuser=True, **cls.credentials + ) cls.c.login(**cls.credentials)