示例#1
0
文件: Tests.py 项目: VicSera/UBB
    def test_add_student__unique_id__exception(self):
        repository = Repository()
        student_service = StudentService(repository)

        student_service.add_student(1, 'Vic Sera', 10, 10)
        self.assertRaises(ValidationError, student_service.add_student, 1,
                          'This Will Crash', 10, 10)
示例#2
0
from Modules.Repositories.FileRepository import FileRepository
from Modules.Services.StudentService import StudentService
from Modules.UI.ConsoleUI import ConsoleUI

student_repository = FileRepository('students.txt')
student_service = StudentService(student_repository)

ui = ConsoleUI(student_service)
示例#3
0
文件: Tests.py 项目: VicSera/UBB
    def test_add_student__grade_not_between_1_10__exception(self):
        repository = Repository()
        student_service = StudentService(repository)

        self.assertRaises(ValidationError, student_service.add_student, 1,
                          'Qwe, Rty', 10, 11)
示例#4
0
文件: Tests.py 项目: VicSera/UBB
    def test_add_student__attendances_negative__exception(self):
        repository = Repository()
        student_service = StudentService(repository)

        self.assertRaises(ValidationError, student_service.add_student, 1,
                          'Qwe Rty', -10, 10)
示例#5
0
文件: Tests.py 项目: VicSera/UBB
    def test_add_student__name_too_short__exception(self):
        repository = Repository()
        student_service = StudentService(repository)

        self.assertRaises(ValidationError, student_service.add_student, 1,
                          'Li Shen', 10, 10)
示例#6
0
文件: Tests.py 项目: VicSera/UBB
    def test_add_student__valid_name__no_exception(self):
        repository = Repository()
        student_service = StudentService(repository)

        student_service.add_student(1, 'Qwe Rty', 10, 10)
        self.assertEqual(1, len(repository.get_all_students()))
示例#7
0
文件: Tests.py 项目: VicSera/UBB
    def test_add_student__name_without_2_words__exception(self):
        repository = Repository()
        student_service = StudentService(repository)

        self.assertRaises(ValidationError, student_service.add_student, 1,
                          'Crash', 10, 10)