# Path: ctleweb/projtrack/report_generator.py
# def check_semester(sem):
#     try:
#         try:
#             return list(Project.objects.filter(semester=sem))
#         except TypeError:
#             return [Project.objects.filter(semester=sem)]
#     except ObjectDoesNotExist:
#         return []
# 
# def check_client(cli):
#     try:
#         try:
#             return list(Project.objects.filter(client=cli))
#         except TypeError:
#             return [Project.objects.filter(client=cli)]
#     except ObjectDoesNotExist:
#         return []
# 
# def check_department(depart):
#     try:
#         try:
#             cli = Client.objects.filter(department=depart)
#             return list(Project.objects.filter(client=cli))
#         except TypeError:
#             cli = Client.objects.filter(department=depart)
#             return [Project.objects.filter(client=cli)]
#     except ObjectDoesNotExist:
#         return []
# 
# def check_type(proj):
#     try:
#         try:
#             return list(Project.objects.filter(type=proj))
#         except TypeError:
#             return [Project.objects.filter(type=proj)]
#     except ObjectDoesNotExist:
#         return []


import datetime
import django.test
from django.contrib.auth.models import User as App_User
from projtrack.models import Client, Project, Type, User, Department, Semester
from .report_generator import check_semester, check_client, check_department, check_type

    def test_check_semester(self):
        sem = Semester.objects.get(name="Test")
        self.assertEqual(check_semester(sem),
                         [Project.objects.get(semester=sem)])

    def test_check_semester_2(self):
        sem = Semester.objects.get(name="Test")
        pro = check_semester(sem)
        self.assertEqual(pro[0].title, "Test")

    def test_semester_get(self):
        sem = Semester.objects.get(name="Test")
        self.assertNotEqual('', str(sem))

    def test_get_user(self):
        use = User.objects.get(username="techconbob")
        self.assertNotEqual('', str(use))

    def test_check_user(self):
        use = User.objects.get(username="techconbob")
        sem = Semester.objects.get(name="Test2")
        self.assertEqual(check_semester(sem),
                         [Project.objects.get(users=use)])

    def test_get_client(self):
        cli = Client.objects.get(email="roberts@email.com")
        self.assertNotEqual('', str(cli))

    def test_check_client(self):
        sem = Client.objects.get(email="roberts@email.com")

# Path: ctleweb/projtrack/report_generator.py
# def check_semester(sem):
#     try:
#         try:
#             return list(Project.objects.filter(semester=sem))
#         except TypeError:
#             return [Project.objects.filter(semester=sem)]
#     except ObjectDoesNotExist:
#         return []
# 
# def check_client(cli):
#     try:
#         try:
#             return list(Project.objects.filter(client=cli))
#         except TypeError:
#             return [Project.objects.filter(client=cli)]
#     except ObjectDoesNotExist:
#         return []
# 
# def check_department(depart):
#     try:
#         try:
#             cli = Client.objects.filter(department=depart)
#             return list(Project.objects.filter(client=cli))
#         except TypeError:
#             cli = Client.objects.filter(department=depart)
#             return [Project.objects.filter(client=cli)]
#     except ObjectDoesNotExist:
#         return []
# 
# def check_type(proj):
#     try:
#         try:
#             return list(Project.objects.filter(type=proj))
#         except TypeError:
#             return [Project.objects.filter(type=proj)]
#     except ObjectDoesNotExist:
#         return []


# Path: ctleweb/projtrack/tests.py
import datetime
import django.test
from django.contrib.auth.models import User as App_User
from projtrack.models import Client, Project, Type, User, Department, Semester
from .report_generator import check_semester, check_client, check_department, check_type

    def test_check_semester(self):
        sem = Semester.objects.get(name="Test")
        self.assertEqual(check_semester(sem),
                         [Project.objects.get(semester=sem)])

    def test_check_semester_2(self):
        sem = Semester.objects.get(name="Test")
        pro = check_semester(sem)
        self.assertEqual(pro[0].title, "Test")

    def test_semester_get(self):
        sem = Semester.objects.get(name="Test")
        self.assertNotEqual('', str(sem))

    def test_get_user(self):
        use = User.objects.get(username="techconbob")
        self.assertNotEqual('', str(use))

    def test_check_user(self):
        use = User.objects.get(username="techconbob")
        sem = Semester.objects.get(name="Test2")
        self.assertEqual(check_semester(sem),
                         [Project.objects.get(users=use)])

    def test_get_client(self):
        cli = Client.objects.get(email="roberts@email.com")
        self.assertNotEqual('', str(cli))

    def test_check_client(self):
        sem = Client.objects.get(email="roberts@email.com")

        self.assertEqual(check_client(sem),
