-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #611 from CTPUG/schedule-test-cleanup
Tests: Use common test and user creation fixture functions
- Loading branch information
Showing
10 changed files
with
130 additions
and
211 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
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from wafer.talks.models import Talk, TalkType | ||
from wafer.tests.utils import create_user | ||
|
||
|
||
def create_talk_type(name): | ||
"""Create a talk type""" | ||
return TalkType.objects.create(name=name) | ||
|
||
|
||
def create_talk(title, status, username=None, user=None, talk_type=None): | ||
if sum((user is None, username is None)) != 1: | ||
raise ValueError('One of user OR username must be specified') | ||
if username: | ||
user = create_user(username) | ||
talk = Talk.objects.create( | ||
title=title, status=status, corresponding_author_id=user.id) | ||
talk.authors.add(user) | ||
talk.notes = "Some notes for talk %s" % title | ||
talk.private_notes = "Some private notes for talk %s" % title | ||
talk.save() | ||
if talk_type: | ||
talk.talk_type = talk_type | ||
talk.save() | ||
return talk |
Oops, something went wrong.