Exemple #1
0
 def test_encode_unique_bulkdeadline_id(self):
     d = Deadline(deadline=datetime(2000, 12, 24, 22, 30, 49))
     self.assertEquals(encode_bulkdeadline_id(d),
                       '2000-12-24T22_30_49--')
     d.text = 'Hello world'
     self.assertEquals(encode_bulkdeadline_id(d),
                       '2000-12-24T22_30_49--{0}'.format(sha1hash('Hello world')))
     # Ensure unicode works
     d.text = u'\u00e5ello world'
     self.assertEquals(encode_bulkdeadline_id(d),
                       '2000-12-24T22_30_49--{0}'.format(sha1hash(u'\u00e5ello world')))
Exemple #2
0
 def _geturl(self, deadline=None):
     deadline = deadline or self.testhelper.sub_p1_a1_g1_d1
     bulkdeadline_id = encode_bulkdeadline_id(deadline)
     return '/devilry_subjectadmin/rest/deadlinesbulk/{0}/{1}'.format(self.testhelper.sub_p1_a1.id,
                                                                      bulkdeadline_id)