forked from manjurulhoque/django-job-portal
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import * #noqa | ||
from . import * # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import factory | ||
from jobsapp.models import User, Job | ||
|
||
from jobsapp.models import Job, User | ||
|
||
|
||
# List of factories | ||
class UserFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = User | ||
django_get_or_create = ('first_name', 'last_name') | ||
django_get_or_create = ("first_name", "last_name") | ||
|
||
first_name = 'John' | ||
last_name = 'Doe' | ||
first_name = "John" | ||
last_name = "Doe" | ||
|
||
|
||
class JobFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = Job | ||
django_get_or_create = ('type') | ||
django_get_or_create = "type" | ||
|
||
user = factory.SubFactory('jobsapp.tests.UserFactory') | ||
title = factory.Sequence(lambda n: 'Title %d' % n) | ||
description = factory.Sequence(lambda n: 'Description %d' % n) | ||
type = '1' | ||
user = factory.SubFactory("jobsapp.tests.UserFactory") | ||
title = factory.Sequence(lambda n: "Title %d" % n) | ||
description = factory.Sequence(lambda n: "Description %d" % n) | ||
type = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import pytest | ||
|
||
from tests.factories import UserFactory | ||
|
||
|
||
# Create your tests here. | ||
@pytest.mark.django_db | ||
class TestExampe: | ||
def test__exemple__ok(self): | ||
user = UserFactory(first_name='Geeks', last_name='.CAT') | ||
assert user.first_name == 'Geeks' | ||
user = UserFactory(first_name="Geeks", last_name=".CAT") | ||
assert user.first_name == "Geeks" |