from django.test import TestCase from mixer.backend.django import mixer from accounts.models import User, UserProfile class UserProfileModelTest(TestCase): def test_string_representation(self): user = mixer.blend(User, username='test') profile = UserProfile(user=user) self.assertEqual(str(profile), str(user.username))