def test_dynamic_path_creation(self): """check dynamic path is correctly generated and stored in DB""" content = Contenido.objects.get(keyword=self.existing_wallpaper) sms = SMS.objects.get(msg=self.existing_wallpaper) dyn_path = create_dynpath(sms,content) stored_dyn = Dynpath.objects.get(id=dyn_path.id) self.assertEqual(stored_dyn,dyn_path) self.assertTrue(stored_dyn.url_path)
def test_dynamic_path_access_ringtone(self): """dynamic url exists and generates expected content""" content = Contenido.objects.get(keyword=self.existing_ringtone) sms = SMS.objects.get(msg=self.existing_ringtone) dyn_path = create_dynpath(sms,content) url = '/content/' + str(dyn_path.url_path) + "/" resp = self.client.get(url) self.assertEqual(resp.status_code,200) self.assertEqual(resp.get('Content-Disposition'),"attachment; filename=hello.txt")