SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 2f96e5d3 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add profiles factories and tests

parent 20b89324
No related branches found
No related tags found
No related merge requests found
__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"
import factory
from .models import Profile
from scipost.constants import TITLE_CHOICES, SCIPOST_DISCIPLINES
class ProfileFactory(factory.django.DjangoModelFactory):
title = factory.Iterator(TITLE_CHOICES, getter=lambda c: c[0])
first_name = factory.Faker('first_name')
last_name = factory.Faker('last_name')
discipline = factory.Iterator(SCIPOST_DISCIPLINES[2][1], getter=lambda c: c[0])
class Meta:
model = Profile
__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"
from django.test import TestCase
from ..models import Profile
from ..factories import ProfileFactory
from common.helpers.test import add_groups_and_permissions
class ProfileTestCase(TestCase):
def setUp(self):
add_groups_and_permissions()
def test_last_name_cannot_be_blank(self):
profile = ProfileFactory()
self.assert(profile.last_name is not None)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment