# 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

        p1.users.add(User.objects.create(username="admin"))
        p2 = Project.objects.create(title="Stuff",
                               description="Why",
                               date=datetime.date.today(),
                               type=Type.objects.create(name="Test"),
                               walk_in=False,
                               client=Client.objects.create(first_name="Jerry",
                                                            last_name="Jerries",
                                                            department=Department.objects.create(name="Science"),
                                                            email='jerries@email.com'),
                               semester=Semester.objects.create(name="Test2"),
                               completed=False)
        p2.save()
        p2.users.add(User.objects.create(username="techconbob"))
        p3 = Project.objects.create(title="Help",
                               description="Testing",
                               date=datetime.date.today(),
                               type=Type.objects.create(name="Help"),
                               walk_in=False,
                               client=Client.objects.create(first_name="Larry",
                                                            last_name="Lawrence",
                                                            department=Department.objects.create(name="CTLE"),
                                                            email='jerries@email.com'),
                               semester=Semester.objects.create(name="Later"),
                               completed=False)
        p3.save()
        p3.users.add(User.objects.create(username="harry"))

    def test_check_semester(self):
        sem = Semester.objects.get(name="Test")

# 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

        p1.users.add(User.objects.create(username="admin"))
        p2 = Project.objects.create(title="Stuff",
                               description="Why",
                               date=datetime.date.today(),
                               type=Type.objects.create(name="Test"),
                               walk_in=False,
                               client=Client.objects.create(first_name="Jerry",
                                                            last_name="Jerries",
                                                            department=Department.objects.create(name="Science"),
                                                            email='jerries@email.com'),
                               semester=Semester.objects.create(name="Test2"),
                               completed=False)
        p2.save()
        p2.users.add(User.objects.create(username="techconbob"))
        p3 = Project.objects.create(title="Help",
                               description="Testing",
                               date=datetime.date.today(),
                               type=Type.objects.create(name="Help"),
                               walk_in=False,
                               client=Client.objects.create(first_name="Larry",
                                                            last_name="Lawrence",
                                                            department=Department.objects.create(name="CTLE"),
                                                            email='jerries@email.com'),
                               semester=Semester.objects.create(name="Later"),
                               completed=False)
        p3.save()
        p3.users.add(User.objects.create(username="harry"))

    def test_check_semester(self):
        sem = Semester.objects.get(name="Test")

        self.assertEqual(check_semester(sem),
