from django.test import TestCase
from club.models import *


class ClubTestCase(TestCase):
    def test_model_creation(self):
        jdoe_address = Address.objects.create(address="123 MyStreet apt 666",
                                              city='MyCity',
                                              state_province='MyProvince',
                                              country='MyCountry',
                                              postal_zip_code='123456')

        club_address = Address.objects.create(address="456 OtherStreet",
                                              city='ClubsCity',
                                              state_province='ClubsProvince',
                                              country='ClubsCountry',
                                              postal_zip_code='7890123')

        club = Club.objects.create(name='Tennis Club',
                                   creation_date='1968-05-21',
                                   address=club_address,
                                   details="Fun Club.")

        Staff.objects.create(club=club,
                             first_name='Staff',
                             last_name='Staffee',
                             title='President',
                             details="Doing business",
                             email="staff@staffee.com",
                             phone="000-000-0000")

        jdoe_level = Level.objects.create(level=Level.LEVEL_INTERMEDIATE,
                                          rating=Level.RATING_4_0)

        jdoe = Member.objects.create(club=club,
                                     first_name='John',
                                     last_name='Doe',
                                     age=25,
                                     address=jdoe_address,
                                     email='jdoe@doe.com',
                                     level=jdoe_level,
                                     gender=Member.GENDER_MALE)

        jdoe_mship = Membership.objects.create(member=jdoe,
                                               start="2010-01-01",
                                               expiry="2010-01-31")

        program = Program.objects.create(program="Men's A League",
                                         start="2010-01-01",
                                         expiry="2010-01-31",
                                         fee="10",
                                         details="Advanced men's league")

        ProgramSubscriber.objects.create(membership=jdoe_mship,
                                         program=program,
                                         paid=True)
