コード例 #1
0
ファイル: user_test.py プロジェクト: nitishparkar/udacityplus
    def testUsersInCourse(self):
        inCS101c = CourseAttempt.query(
            CourseAttempt.course == ndb.Key(Course, 'udacitycs101'),
            CourseAttempt.completed == True).fetch(5)

        self.assertEqual(
            len(inCS101c), 1,
            "Wrong number of students completed CS101: %s should be 1" %
            len(inCS101c))

        incomplete = CourseAttempt.query(
            CourseAttempt.completed == False).fetch(5)

        self.assertEqual(
            len(incomplete), 1,
            "Wrong number of total course enrollments %s should be 1" %
            len(incomplete))

        completed = CourseAttempt.query(
            CourseAttempt.completed == True).fetch(5)

        self.assertEqual(
            len(completed), 2,
            "Wrong number of total course enrollments %s should be 2" %
            len(completed))
コード例 #2
0
ファイル: user_test.py プロジェクト: nitishparkar/udacityplus
    def testStudentsInClass(self):
        uinCS101 = CourseAttempt.query(
            CourseAttempt.course == ndb.Key(Course, 'udacitycs101'), ).get()

        self.assertIsNotNone(uinCS101,
                             "Zero students in class, should be non-zero")
        self.assertEqual(
            uinCS101.student, self.u1.key,
            "Wrong user %s, should be %s" % (uinCS101.student, self.u1.key))
コード例 #3
0
ファイル: user_test.py プロジェクト: Ramesh7128/udacityplus
    def testUsersInCourse(self):
        inCS101c = CourseAttempt.query(
            CourseAttempt.course == ndb.Key(Course, 'udacitycs101'),
            CourseAttempt.completed == True).fetch(5)

        self.assertEqual(len(inCS101c), 1, "Wrong number of students completed CS101: %s should be 1" % len(inCS101c))

        incomplete = CourseAttempt.query(
            CourseAttempt.completed == False
        ).fetch(5)

        self.assertEqual(len(incomplete), 1, "Wrong number of total course enrollments %s should be 1" % len(incomplete))

        completed = CourseAttempt.query(
            CourseAttempt.completed == True
        ).fetch(5)

        self.assertEqual(len(completed), 2, "Wrong number of total course enrollments %s should be 2" % len(completed))
コード例 #4
0
ファイル: user_test.py プロジェクト: Ramesh7128/udacityplus
    def testStudentsInClass(self):
        uinCS101 = CourseAttempt.query(
            CourseAttempt.course == ndb.Key(Course, 'udacitycs101'),
        ).get()

        self.assertIsNotNone(uinCS101, "Zero students in class, should be non-zero")
        self.assertEqual(uinCS101.student,
            self.u1.key, "Wrong user %s, should be %s" %
                                   (uinCS101.student, self.u1.key)
        )
コード例 #5
0
ファイル: user_test.py プロジェクト: nitishparkar/udacityplus
 def testGetAllAttempts(self):
     attempts = CourseAttempt().query().fetch(10)
     self.assertEqual(len(attempts), 3,
                      "Wrong number of attempts %s, should be 3" % attempts)