# Path: app/api/tests/utils.py
# def create_admin_account():
#     return User.objects.create_superuser(*admin_test_credentials)
# 
# def make_request(client, query, method='GET'):
#     header = {
#         'HTTP_X_TAVERNATOKEN': obtain_api_key(client)
#     }
# 
#     if method == 'GET':
#         return client.get(endpoint, data={'query': query}, **header).json()
# 
#     if method == 'POST':
#         return client.post(endpoint, data={'query': query}, **header).json()
# 
# Path: app/timetables/factories.py
# class TimetableFactory(TimestampFactory):
#     """Timetable model factory."""
# 
#     class Meta:
#         model = models.Timetable
# 
#     name = 'Fellows Timetable'
#     cycle_length = 14
#     ref_cycle_day = 2
#     ref_cycle_date = datetime.date(2016, 10, 1)
#     description = 'Some random description'
#     inactive_weekdays = '0,2'


from django.test import Client, TestCase
from .utils import create_admin_account, make_request
from app.timetables.factories import TimetableFactory



class TimetableApiTest(TestCase):

    def setUp(self):
        self.client = Client()
        create_admin_account()
        self.timetable = TimetableFactory()

    def retrieve_timetables(self):

# Path: app/api/tests/utils.py
# def create_admin_account():
#     return User.objects.create_superuser(*admin_test_credentials)
# 
# def make_request(client, query, method='GET'):
#     header = {
#         'HTTP_X_TAVERNATOKEN': obtain_api_key(client)
#     }
# 
#     if method == 'GET':
#         return client.get(endpoint, data={'query': query}, **header).json()
# 
#     if method == 'POST':
#         return client.post(endpoint, data={'query': query}, **header).json()
# 
# Path: app/timetables/factories.py
# class TimetableFactory(TimestampFactory):
#     """Timetable model factory."""
# 
#     class Meta:
#         model = models.Timetable
# 
#     name = 'Fellows Timetable'
#     cycle_length = 14
#     ref_cycle_day = 2
#     ref_cycle_date = datetime.date(2016, 10, 1)
#     description = 'Some random description'
#     inactive_weekdays = '0,2'


# Path: app/api/tests/test_timetable_api.py
from django.test import Client, TestCase
from .utils import create_admin_account, make_request
from app.timetables.factories import TimetableFactory




class TimetableApiTest(TestCase):

    def setUp(self):
        self.client = Client()
        create_admin_account()
        self.timetable = TimetableFactory()

    def retrieve_timetables(self):

        query = 'query {timetables{edges{node{name}}}}'