def add_owner(self, card_id):
     if AppUser.for_user(users.get_current_user()).is_admin:
         card = ReportCard.find_by_id(int(card_id))
         card.owner_user_id.append(self.request.get('new_owner_id'))
         card.put()
         ReportCard.create(self.request.get('name'))
         return webapp2.redirect_to('card-list')
 def test_add_owner(self):
     self.makeAdmin()
     c = ReportCard.find_by_id(ReportCard.create(name='Add Owner Test Name').id())
     self.assertEqual(1, len(c.owner_user_id))
     response = self.testapp.post('/card/%d/add_owner' % c.key().id(), {'new_owner_id':'newowner'})
     self.assertRedirect('/card/list$', response)
     c = ReportCard.find_by_id(c.key().id())
     self.assertEqual(2, len(c.owner_user_id))
 def setUp(self):
     super(SignatureHandlerTest, self).setUp()
     self.card_id = ReportCard.create(name='Signature Test Card').id()
 def setUp(self):
     super(TextLineHandlerTest, self).setUp()
     self.card_id = ReportCard.create(name='Category Test Card').id()
 def setUp(self):
     super(ItemHandlerTest, self).setUp()
     self.card_id = ReportCard.create(name="Item Test Card").id()
     self.category_id = EvalCategory.create("Item Test Category", self.card_id).id()
 def test_add_owner_form(self):
     self.makeAdmin()
     c = ReportCard.create(name='Add Owner Form Test Name')
     response = self.testapp.get('/card/%d/add_owner_form' % c.id())
     self.assertSuccess(response)
 def test_preview(self):
     c = ReportCard.create(name='Preview Test Name')
     response = self.testapp.get('/card/%d/preview' % c.id())
     self.assertSuccess(response)
 def test_edit(self):
     c = ReportCard.create(name='Edit Test Name')
     response = self.testapp.get('/card/%d/edit' % c.id())
     self.assertSuccess(response)
 def setUp(self):
     super(CategoryHandlerTest, self).setUp()
     self.card_id = ReportCard.create(name="Category Test Card").id()
 def setUp(self):
     super(EvalHandlerTest, self).setUp()
     self.card_id = ReportCard.create(name='Eval Test Card').id()
 def setUp(self):
     super(KeyLevelHandlerTest, self).setUp()
     self.card_id = ReportCard.create(name='Key Level Test Card').id()
 def add(self):
     ReportCard.create(self.request.get('name'))
     return webapp2.redirect_to('card-list')