async def test_podcasts__create__ok(client, db_objects, podcast, urls): request_data = {"name": "test name", "description": "test description"} response = await client.post(urls.podcasts_list, data=request_data, allow_redirects=False) assert response.status == 302 created_podcast = await db_objects.get(Podcast.select().order_by( Podcast.created_at.desc())) assert response.headers["Location"] == f"/podcasts/{created_podcast.id}/" assert created_podcast.name == "test name" assert created_podcast.description == "test description"
async def _get_object(self) -> Podcast: try: podcast = await self.request.app.objects.get( Podcast.select().where( Podcast.created_by_id == self.user.id).order_by( Podcast.created_at.desc())) except peewee.DoesNotExist: podcast = await Podcast.create_first_podcast( self.request.app.objects, self.user.id) return podcast
def regenerate_rss(): podcasts = list(Podcast.select()) for podcast in podcasts: generate_rss(podcast.id)