def test_performance_creation(self): performance_route = '/_admin/performance' self.admin_app.post(performance_route, {'action':'create'}, status=403) # tells blank posts to bugger off old_count = self.lady_andal.get_performances().count() name = self.random() url = self.random() performance_data = dict(action='create', show_key=self.hamlet.key(), venue_key=self.lady_andal.key(), year=self.two_days_later.date().year, month=self.two_days_later.date().month, day=self.two_days_later.date().day, hour=self.two_days_later.time().hour, minute=self.two_days_later.time().minute) self.admin_app.post(performance_route, performance_data) self.assertEqual(old_count + 1, self.lady_andal.get_performances().count()) result = Performance.all().filter('show =', self.hamlet).filter('venue =', self.lady_andal).filter('utc_date_time =', self.two_days_later).fetch(1)[0] self.assertTrue(result)
def test_cascading_deletes(self): self.make_performance(self.hamlet, self.lady_andal, self.one_day_later) self.make_performance(self.hamlet, self.lady_andal, self.two_days_later) perf_count = Performance.all().count() self.lady_andal.delete() self.assertEqual(perf_count-2,Performance.all().count())
def get(self, url = None): self.render('admin/performance.html', dict(performances=Performance.all(), shows=Show.all(), venues=Venue.all()))