1
# Ubuntu Developer Summit web application
2
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU Affero General Public License as
6
# published by the Free Software Foundation, either version 3 of the
7
# License, or (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU Affero General Public License for more details.
14
# You should have received a copy of the GNU Affero General Public License
15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
from django import test as djangotest
21
from django.core.urlresolvers import reverse
23
from django.contrib.auth.models import User
24
from summit.schedule.models import Summit
25
from summit.sponsor.models import (
26
SponsorshipSuggestion,
27
SponsorshipSuggestionScore,
28
NonLaunchpadSponsorship,
29
NonLaunchpadSponsorshipScore,
32
class SponsorshipDisplayTestCase(djangotest.TestCase):
33
"""Tests for the 'reschedule' management command."""
36
self.summit = Summit.objects.create(
39
location='Test Location',
40
description='Test Summit Description',
42
last_update=datetime.datetime.now(),
44
date_start=(datetime.datetime.now() + datetime.timedelta(days=1)),
45
date_end=(datetime.datetime.now() + datetime.timedelta(days=6)),
48
self.user = User.objects.create(
54
def test_sponsorship_display(self):
55
sponsorship = SponsorshipSuggestion.objects.create(
56
suggested_by=self.user,
57
name='Test Suggestion',
58
launchpad_name='testsuggestion',
60
location='Test Location',
61
country='Test Country',
62
about='Test About Description',
64
needs_accomodation=False,
67
further_info='Test Further Info',
70
scorer = User.objects.create(
71
username='testscorer',
75
score = SponsorshipSuggestionScore.objects.create(
76
sponsorship=sponsorship,
79
comment='Test Comment',
82
self.assertEquals(unicode(score), "testsuggestion by testscorer: 1")
84
def test_nonlaunchpad_display(self):
85
sponsorship = NonLaunchpadSponsorship.objects.create(
86
requested_by=self.user,
87
name='Test Sponsorship',
88
company='Test Company',
89
email='test@example.org',
91
location='Test Location',
92
country='Test Country',
93
about='Test About Description',
95
needs_accomodation=False,
98
further_info='Test Further Info',
101
scorer = User.objects.create(
102
username='testscorer',
106
score = NonLaunchpadSponsorshipScore.objects.create(
107
sponsorship=sponsorship,
110
comment='Test Comment',
113
self.assertEquals(unicode(score), "Test Sponsorship by testscorer: 1")