',
count=1, status_code=200)
self.assertContains(response, "Invalid thread id, it should look")
def test_reattach_on_itself(self):
threadid = self.messages[0]["Message-ID-Hash"]
request = self.factory.post(reverse('thread_reattach',
args=["list@example.com", threadid]),
data={"parent": threadid})
request.user = self.user
self.store.attach_to_thread = Mock()
response = reattach(request, "list@example.com", threadid)
self.assertFalse(self.store.attach_to_thread.called)
now = datetime.datetime.now()
threads = self.store.get_threads("list@example.com",
now - datetime.timedelta(days=1),
now + datetime.timedelta(days=1))
self.assertEqual(len(threads), 2)
errormsg = '
'
self.assertContains(response, '
',
count=1, status_code=200)
self.assertContains(response, "Can't re-attach a thread to itself")
def test_reattach_on_unknown(self):
threadid = self.messages[0]["Message-ID-Hash"]
threadid_unknown = "L36TVP2EFFDSXGVNQJCY44W5AB2YMJ65"
request = self.factory.post(reverse('thread_reattach',
args=["list@example.com", threadid]),
data={"parent": threadid_unknown})
request.user = self.user
self.store.attach_to_thread = Mock()
response = reattach(request, "list@example.com", threadid)
self.assertFalse(self.store.attach_to_thread.called)
now = datetime.datetime.now()
errormsg = '
'
self.assertContains(response, '
',
count=1, status_code=200)
self.assertContains(response, "Unknown thread")
def test_reattach_old_to_new(self):
threadid1 = self.messages[0]["Message-ID-Hash"]
threadid2 = self.messages[1]["Message-ID-Hash"]
request = self.factory.post(reverse('thread_reattach',
args=["list@example.com", threadid1]),
data={"parent": threadid2})
request.user = self.user
self.store.attach_to_thread = Mock()
response = reattach(request, "list@example.com", threadid1)
self.assertFalse(self.store.attach_to_thread.called)
now = datetime.datetime.now()
threads = self.store.get_threads("list@example.com",
now - datetime.timedelta(days=1),
now + datetime.timedelta(days=1))
self.assertEqual(len(threads), 2)
errormsg = '
'
self.assertContains(response, '
',
count=1, status_code=200)
self.assertContains(response, "Can't attach an older thread to a newer thread.",
count=1, status_code=200)