Ejemplo n.º 1
0
          def test_display_user_cat_test(self):
            #Test the post functionality of the question view         
            user = User.objects.create_user('john', '*****@*****.**', 'johnpassword')
            user.save()
            self.client.login(username='******', password='******')
            
            #create structures
            cat_test = CatTest()
            cat_test.name = "Short Test"
            cat_test.save()
            domain = Domain.objects.get(pk=1)
            item_bank = ItemBank()
            item_bank.name = "Fractions"
            item_bank.topic = "Addition"
            item_bank.domain = domain
            item_bank.template = ItemBankTemplate.objects.get(pk=1)
            item_bank.question_type = QuestionType.objects.get(pk=1)
            item_bank.save()
            user_item_bank = UserItemBank()
            user_item_bank.user = user
            user_item_bank.item_bank = item_bank
            user_item_bank.save()
			#Create a threshold
            grd = Grade.objects.get(name="A")
            thresh = Threshold()
            thresh.grade = grd
            thresh.item_bank = item_bank
            thresh.ability = -1
            thresh.init_prob =50			
            thresh.save()
            user_item_bank.probabilities()
            user_cat_test = UserCatTest()
            user_cat_test.user = user
            user_cat_test.item_bank = item_bank
            user_cat_test.cat_test = cat_test
            user_cat_test.save()
            response = self.client.get('/end/')
            self.assertIn('Ability: 0',response.content)
            user_item_bank = UserItemBank.objects.get(pk=1)
            self.assertEqual(user_item_bank.tests,1)
            #Should show probabilities
            self.assertIn('50%',response.content)
Ejemplo n.º 2
0
 def test_create_and_save(self):
   grd = Grade.objects.get(name="A")
   domain = Domain.objects.get(name="Number")
   item_bank = ItemBank()
   item_bank.name = "Fractions"
   item_bank.topic = "Addition"
   item_bank.domain = domain
   item_bank.template = ItemBankTemplate.objects.get(pk=1)
   item_bank.question_type = QuestionType.objects.get(pk=1)
   item_bank.save()
   thresh = Threshold()
   thresh.grade = grd
   thresh.item_bank = item_bank
   thresh.ability = -1
   thresh.init_prob = 50	  
   thresh.save()
   thresh = Threshold.objects.all()[0]
   self.assertEquals(thresh.ability,-1)
   self.assertEquals(thresh.grade.name,"A")
   self.assertEquals(thresh.item_bank.name,"Fractions")
   self.assertEquals(thresh.init_prob,50)