Ejemplo n.º 1
0
    def setUp(self):
        self.nr_ratings = 5
        Populator().populate_database(nr_universities=3,
                                      nr_users=5,
                                      nr_professors=10,
                                      nr_courses=10,
                                      nr_comments=2,
                                      nr_ratings=self.nr_ratings)
        self.client = Client()

        Populator().populate_database(nr_users=1)
        users = jUser.objects.all()
        self.user = users[len(users) - 1]
        self.client.login(username=self.user.username, password='******')
Ejemplo n.º 2
0
 def setUp(self):
     self.nr_comments = 5
     Populator().populate_database(nr_universities=3,
                                   nr_users=5,
                                   nr_professors=10,
                                   nr_courses=10,
                                   nr_comments=self.nr_comments)
     self.client = Client()
     user = random.choice(jUser.objects.all())
     self.client.login(username=user.username, password='******')
Ejemplo n.º 3
0
 def test_populate_db(self):
     populator = Populator()
     nr_universities = 3
     nr_users = 5
     nr_professors = 10
     nr_courses = 10
     nr_comments = 30
     nr_ratings = 30
     populator.populate_database(nr_universities=nr_universities,
                                 nr_users=nr_users,
                                 nr_professors=nr_professors,
                                 nr_courses=nr_courses,
                                 nr_comments=nr_comments,
                                 nr_ratings=nr_ratings)
     self.assertEqual(len(University.objects.all()), nr_universities)
     self.assertEqual(len(jUser.objects.all()), nr_users)
     self.assertEqual(len(Professor.objects.all()), nr_professors)
     self.assertEqual(len(Course.objects.all()), nr_courses)
     self.assertEqual(len(Review.objects.all()), nr_comments)
     self.assertEqual(len(Rating.objects.all()), nr_ratings)
Ejemplo n.º 4
0
 def setUp(self):
     Populator().populate_database(nr_universities=3, nr_users=5)
     self.client = Client(enforce_csrf_checks=False)