Fixed a problem with stability of test_accept_reject_nomination_edges(), and made some changes to make debugging this easier.
- Legacy-Id: 12829
This commit is contained in:
parent
5556e87a07
commit
e5f889764c
|
@ -126,7 +126,7 @@ class PositionFactory(factory.DjangoModelFactory):
|
|||
class Meta:
|
||||
model = Position
|
||||
|
||||
name = factory.Faker('sentence',nb_words=10)
|
||||
name = factory.Faker('sentence',nb_words=5)
|
||||
is_open = True
|
||||
|
||||
class NomineeFactory(factory.DjangoModelFactory):
|
||||
|
|
|
@ -150,7 +150,7 @@ class NomineePosition(models.Model):
|
|||
super(NomineePosition, self).save(**kwargs)
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s - %s" % (self.nominee, self.position)
|
||||
return u"%s - %s - %s" % (self.nominee, self.state, self.position)
|
||||
|
||||
@property
|
||||
def questionnaires(self):
|
||||
|
|
|
@ -1103,7 +1103,7 @@ class InactiveNomcomTests(TestCase):
|
|||
def test_acceptance_closed(self):
|
||||
today = datetime.date.today().strftime('%Y%m%d')
|
||||
pid = self.nc.position_set.first().nomineeposition_set.first().id
|
||||
url = reverse('nomcom_process_nomination_status', kwargs = {
|
||||
url = reverse('ietf.nomcom.views.process_nomination_status', kwargs = {
|
||||
'year' : self.nc.year(),
|
||||
'nominee_position_id' : pid,
|
||||
'state' : 'accepted',
|
||||
|
@ -1330,16 +1330,15 @@ class NewActiveNomComTests(TestCase):
|
|||
self.assertEqual(response.status_code,200)
|
||||
|
||||
def test_accept_reject_nomination_edges(self):
|
||||
|
||||
np = self.nc.nominee_set.first().nomineeposition_set.first()
|
||||
|
||||
self.client.logout()
|
||||
np = self.nc.nominee_set.order_by('pk').first().nomineeposition_set.order_by('pk').first()
|
||||
kwargs={'year':self.nc.year(),
|
||||
'nominee_position_id':np.id,
|
||||
'state':'accepted',
|
||||
'date':np.time.strftime("%Y%m%d"),
|
||||
'hash':get_hash_nominee_position(np.time.strftime("%Y%m%d"),np.id),
|
||||
}
|
||||
url = reverse('nomcom_process_nomination_status', kwargs=kwargs)
|
||||
url = reverse('ietf.nomcom.views.process_nomination_status', kwargs=kwargs)
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code,403)
|
||||
self.assertTrue('already was' in unicontent(response))
|
||||
|
@ -1349,13 +1348,13 @@ class NewActiveNomComTests(TestCase):
|
|||
np.save()
|
||||
kwargs['date'] = np.time.strftime("%Y%m%d")
|
||||
kwargs['hash'] = get_hash_nominee_position(np.time.strftime("%Y%m%d"),np.id)
|
||||
url = reverse('nomcom_process_nomination_status', kwargs=kwargs)
|
||||
url = reverse('ietf.nomcom.views.process_nomination_status', kwargs=kwargs)
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code,403)
|
||||
self.assertTrue('Link expired' in unicontent(response))
|
||||
|
||||
kwargs['hash'] = 'bad'
|
||||
url = reverse('nomcom_process_nomination_status', kwargs=kwargs)
|
||||
url = reverse('ietf.nomcom.views.process_nomination_status', kwargs=kwargs)
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code,403)
|
||||
self.assertTrue('Bad hash!' in unicontent(response))
|
||||
|
@ -1363,7 +1362,7 @@ class NewActiveNomComTests(TestCase):
|
|||
def test_accept_reject_nomination_comment(self):
|
||||
np = self.nc.nominee_set.first().nomineeposition_set.first()
|
||||
hash = get_hash_nominee_position(np.time.strftime("%Y%m%d"),np.id)
|
||||
url = reverse('nomcom_process_nomination_status',
|
||||
url = reverse('ietf.nomcom.views.process_nomination_status',
|
||||
kwargs={'year':self.nc.year(),
|
||||
'nominee_position_id':np.id,
|
||||
'state':'accepted',
|
||||
|
|
|
@ -40,7 +40,7 @@ urlpatterns = [
|
|||
url(r'^(?P<year>\d{4})/feedback/$', views.public_feedback, name='nomcom_public_feedback'),
|
||||
url(r'^(?P<year>\d{4})/nominate/$', views.public_nominate, name='nomcom_public_nominate'),
|
||||
url(r'^(?P<year>\d{4})/nominate/newperson$', views.public_nominate_newperson, name='nomcom_public_nominate_newperson'),
|
||||
url(r'^(?P<year>\d{4})/process-nomination-status/(?P<nominee_position_id>\d+)/(?P<state>[\w]+)/(?P<date>[\d]+)/(?P<hash>[a-f0-9]+)/$', views.process_nomination_status, name='nomcom_process_nomination_status'),
|
||||
url(r'^(?P<year>\d{4})/process-nomination-status/(?P<nominee_position_id>\d+)/(?P<state>[\w]+)/(?P<date>[\d]+)/(?P<hash>[a-f0-9]+)/$', views.process_nomination_status),
|
||||
# use the generic view from message
|
||||
url(r'^ann/(?P<message_id>\d+)/$', message_views.message, {'group_type': "nomcom" }),
|
||||
]
|
||||
|
|
|
@ -211,14 +211,14 @@ def send_accept_reminder_to_nominee(nominee_position):
|
|||
(to_email, cc) = gather_address_lists('nomination_accept_reminder',nominee=nominee.email.address)
|
||||
|
||||
hash = get_hash_nominee_position(today, nominee_position.id)
|
||||
accept_url = reverse('nomcom_process_nomination_status',
|
||||
accept_url = reverse('ietf.nomcom.views.process_nomination_status',
|
||||
None,
|
||||
args=(get_year_by_nomcom(nomcom),
|
||||
nominee_position.id,
|
||||
'accepted',
|
||||
today,
|
||||
hash))
|
||||
decline_url = reverse('nomcom_process_nomination_status',
|
||||
decline_url = reverse('ietf.nomcom.views.process_nomination_status',
|
||||
None,
|
||||
args=(get_year_by_nomcom(nomcom),
|
||||
nominee_position.id,
|
||||
|
@ -290,14 +290,14 @@ def make_nomineeposition(nomcom, candidate, position, author):
|
|||
domain = Site.objects.get_current().domain
|
||||
today = datetime.date.today().strftime('%Y%m%d')
|
||||
hash = get_hash_nominee_position(today, nominee_position.id)
|
||||
accept_url = reverse('nomcom_process_nomination_status',
|
||||
accept_url = reverse('ietf.nomcom.views.process_nomination_status',
|
||||
None,
|
||||
args=(get_year_by_nomcom(nomcom),
|
||||
nominee_position.id,
|
||||
'accepted',
|
||||
today,
|
||||
hash))
|
||||
decline_url = reverse('nomcom_process_nomination_status',
|
||||
decline_url = reverse('ietf.nomcom.views.process_nomination_status',
|
||||
None,
|
||||
args=(get_year_by_nomcom(nomcom),
|
||||
nominee_position.id,
|
||||
|
|
Loading…
Reference in a new issue