예제 #1
0
파일: tests.py 프로젝트: campbellr/taskweb
 def test_create_task_undo(self):
     user = self.create_user()
     task = Task(description='foobar', user=user)
     task.save()
     self.assertEqual(len(Undo.objects.all()), 1)
     self.assertNotIn('old', Undo.serialize())
     self.assertEqual(len(Undo.serialize().splitlines()), 3)
     task.delete()
예제 #2
0
파일: tests.py 프로젝트: minineuron/taskweb
 def test_create_task_undo(self):
     user = self.create_user()
     task = Task(description='foobar', user=user)
     task.save()
     self.assertEqual(len(Undo.objects.all()), 1)
     self.assertNotIn('old', Undo.serialize())
     self.assertEqual(len(Undo.serialize().splitlines()), 3)
     task.delete()
예제 #3
0
파일: tests.py 프로젝트: campbellr/taskweb
 def test_edit_task_undo(self):
     user = self.create_user()
     task = Task(description='foobar', user=user)
     task.save()
     task.annotate('annotation')
     self.assertEqual(len(Undo.objects.all()), 2)
     self.assertIn('old', Undo.serialize())
     # 'old' shouldn't have an annotation
     new_undo = Undo.objects.get(pk=2)
     self.assertNotIn('annotation_', new_undo.old)
     self.assertEqual(len(Undo.serialize().splitlines()), 7)
     self.assertNotIn('annotation_', Undo.serialize().splitlines()[4])
예제 #4
0
파일: tests.py 프로젝트: minineuron/taskweb
 def test_edit_task_undo(self):
     user = self.create_user()
     task = Task(description='foobar', user=user)
     task.save()
     task.annotate('annotation')
     self.assertEqual(len(Undo.objects.all()), 2)
     self.assertIn('old', Undo.serialize())
     # 'old' shouldn't have an annotation
     new_undo = Undo.objects.get(pk=2)
     self.assertNotIn('annotation_', new_undo.old)
     self.assertEqual(len(Undo.serialize().splitlines()), 7)
     self.assertNotIn('annotation_', Undo.serialize().splitlines()[4])
예제 #5
0
파일: views.py 프로젝트: minineuron/taskweb
def get_taskdb(request, filename):
    if filename == 'pending.data':
        taskstr = Task.serialize('pending')
    elif filename == 'completed.data':
        taskstr = Task.serialize('completed')
    elif filename == 'undo.data':
        taskstr = Undo.serialize()
    else:
        return HttpResponseNotFound()

    response = HttpResponse(taskstr, mimetype='text/plain')
    response['Content-Length'] = len(taskstr)
    return response