Exemplo n.º 1
0
 def test_add_trail_from_existing_topology(self):
     self.login()
     trail = TrailFactory()
     form_data = self.get_good_data()
     form_data['topology'] = trail.serialize(with_pk=False)
     response = self.client.post(Trail.get_add_url(), form_data)
     self.assertEqual(response.status_code, 302)  # success, redirects to detail view
     p = re.compile(r"/trail/(\d+)/")
     m = p.match(response['Location'])
     new_pk = int(m.group(1))
     new_trail = Trail.objects.get(pk=new_pk)
     self.assertIn(trail, new_trail.trails.all())
Exemplo n.º 2
0
 def test_add_trail_from_existing_topology(self):
     self.login()
     trail = TrailFactory()
     form_data = self.get_good_data()
     form_data['topology'] = trail.serialize(with_pk=False)
     response = self.client.post(Trail.get_add_url(), form_data)
     self.assertEqual(response.status_code, 302)  # success, redirects to detail view
     p = re.compile(r"http://testserver/trail/(\d+)/")
     m = p.match(response['Location'])
     new_pk = int(m.group(1))
     new_trail = Trail.objects.get(pk=new_pk)
     self.assertIn(trail, new_trail.trails.all())