2021-03-28 10:11:56 +00:00
|
|
|
from django.contrib.auth.models import User
|
2021-05-14 00:32:19 +00:00
|
|
|
from django.test import TestCase
|
2021-03-28 10:11:56 +00:00
|
|
|
|
|
|
|
from bookmarks.models import UserProfile
|
|
|
|
|
|
|
|
|
|
|
|
class UserProfileTestCase(TestCase):
|
|
|
|
|
|
|
|
def test_create_user_should_init_profile(self):
|
2024-01-27 10:29:16 +00:00
|
|
|
user = User.objects.create_user("testuser", "test@example.com", "password123")
|
2021-03-28 10:11:56 +00:00
|
|
|
profile = UserProfile.objects.all().filter(user_id=user.id).first()
|
|
|
|
self.assertIsNotNone(profile)
|
2022-08-04 17:37:16 +00:00
|
|
|
|
|
|
|
def test_bookmark_sharing_is_disabled_by_default(self):
|
2024-01-27 10:29:16 +00:00
|
|
|
user = User.objects.create_user("testuser", "test@example.com", "password123")
|
2022-08-04 17:37:16 +00:00
|
|
|
profile = UserProfile.objects.all().filter(user_id=user.id).first()
|
|
|
|
self.assertFalse(profile.enable_sharing)
|