def setUp(self): super(EvalCategoryTest, self).setUp() self.card_id = ReportCard.create("Evaluation Test Card").id() self.category1_id = EvalCategory.create("Evaluation Test Category 1", self.card_id).id() self.category2_id = EvalCategory.create("Evaluation Test Category 2", self.card_id).id() self.item1_id = EvalItem.create("Evaluation Test Item 1", self.category1_id).id() self.item2_id = EvalItem.create("Evaluation Test Item 2", self.category1_id).id() self.item3_id = EvalItem.create("Evaluation Test Item 3", self.category2_id).id() self.text_line1_id = TextLine.create("Evaluation Test Text Line 1", self.card_id).id() self.text_line2_id = TextLine.create("Evaluation Test Text Line 2", self.card_id).id()
def test_items(self): category_id = EvalCategory.create('Category Items Test', self.card_id).id() item1 = EvalItem.find_by_id(EvalItem.create('Category Items Test 1', category_id).id()) item1.position = 5 item1.put() item2 = EvalItem.find_by_id(EvalItem.create('Category Items Test 2', category_id).id()) item2.position = 2 item2.put() item3 = EvalItem.find_by_id(EvalItem.create('Category Items Test 3', category_id).id()) items = EvalCategory.find_by_id(category_id).items() self.assertEqual(3, len(items)) self.assertEqual('Category Items Test 2', items[0].name) self.assertEqual('Category Items Test 1', items[1].name) self.assertEqual('Category Items Test 3', items[2].name)
def test_create(self): item_id = EvalItem.create('Item Create Test', self.category_id).id() item = EvalItem.find_by_id(item_id) self.assertEqual('Item Create Test', item.name) self.assertEqual(self.category_id, item.category.key().id())
def setUp(self): super(EvalItemDataTest, self).setUp() self.card_id = ReportCard.create('Item Data Test Card').id() self.evaluation_id = Evaluation.create('Item Data Test Evaluation', self.card_id).id() self.category_id = EvalCategory.create('Item Data Test Category', self.card_id).id() self.item_id = EvalItem.create('Item Data Test Item', self.category_id).id()