def setUp(self):
		self.site = manager.ManagerSite()
		self.site.register(
			NewsStory, 'body', image_model=NewsImage, image_fieldname='image'
		)
		self.story = NewsStory(headline="Gabriel wins!")
		self.story.save()
		self.image = NewsImage(story=self.story, image=File(open(test_image)))
		self.image.save()
class InstanceTest(TestCase):
	urls = 'view_tests.urls'
	def setUp(self):
		self.site = manager.ManagerSite()
		self.site.register(
			NewsStory, 'body', image_model=NewsImage, image_fieldname='image'
		)
		self.story = NewsStory(headline="Gabriel wins!")
		self.story.save()
		self.image = NewsImage(story=self.story, image=File(open(test_image)))
		self.image.save()
	def test_image_redirect(self):
		settings.DEBUG = True
		url = '/manager/view_tests/newsstory/%d/body/images/%d/url/'%(self.story.pk, self.image.pk)
		
		try:
			response = self.client.get(url)
		except TemplateDoesNotExist, e:
			print e
			print e.args
			raise
		show_debug(response)
		self.assertEqual(response.status_code, 302)