Example #1
0
File: Tests.py Project: 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)
Example #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)
Example #3
0
File: Tests.py Project: 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)
Example #4
0
File: Tests.py Project: 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)
Example #5
0
File: Tests.py Project: 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)
Example #6
0
File: Tests.py Project: 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()))
Example #7
0
File: Tests.py Project: 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)