1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# Ubuntu Developer Summit web application
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
import unittest
from django import test as djangotest
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from summit.schedule.models import Summit
from summit.sponsor.models import (
SponsorshipSuggestion,
SponsorshipSuggestionScore,
NonLaunchpadSponsorship,
NonLaunchpadSponsorshipScore,
)
class SponsorshipDisplayTestCase(djangotest.TestCase):
"""Tests for the 'reschedule' management command."""
def setUp(self):
self.summit = Summit.objects.create(
name='test-summit',
title='Test Summit',
location='Test Location',
description='Test Summit Description',
timezone='UTC',
last_update=datetime.datetime.now(),
state='sponsor',
date_start=(datetime.datetime.now() + datetime.timedelta(days=1)),
date_end=(datetime.datetime.now() + datetime.timedelta(days=6)),
)
self.user = User.objects.create(
username='testuser',
first_name='Test',
last_name='User',
)
def test_sponsorship_display(self):
sponsorship = SponsorshipSuggestion.objects.create(
suggested_by=self.user,
name='Test Suggestion',
launchpad_name='testsuggestion',
summit=self.summit,
location='Test Location',
country='Test Country',
about='Test About Description',
needs_travel=False,
needs_accomodation=False,
would_crew=True,
diet='Test Diet',
further_info='Test Further Info',
)
scorer = User.objects.create(
username='testscorer',
first_name='Test',
last_name='Scorer',
)
score = SponsorshipSuggestionScore.objects.create(
sponsorship=sponsorship,
user=scorer,
score=1,
comment='Test Comment',
)
self.assertEquals(unicode(score), "testsuggestion by testscorer: 1")
def test_nonlaunchpad_display(self):
sponsorship = NonLaunchpadSponsorship.objects.create(
requested_by=self.user,
name='Test Sponsorship',
company='Test Company',
email='test@example.org',
summit=self.summit,
location='Test Location',
country='Test Country',
about='Test About Description',
needs_travel=False,
needs_accomodation=False,
would_crew=True,
diet='Test Diet',
further_info='Test Further Info',
)
scorer = User.objects.create(
username='testscorer',
first_name='Test',
last_name='Scorer',
)
score = NonLaunchpadSponsorshipScore.objects.create(
sponsorship=sponsorship,
user=scorer,
score=1,
comment='Test Comment',
)
self.assertEquals(unicode(score), "Test Sponsorship by testscorer: 1")
|