from django.test import TestCase

from gameruns.models import EmailGameRuns
from training.models import *

class TestModels(TestCase):
    def test_egrun_order_save(self):
        type = Types.objects.create(
            type='typeDeletable'
        )

        email = Emails.objects.create(
            content='this is email',
            type= type
        )

        gamerun = GameRuns.objects.create(
            session='123',
            player_name='patrik',
        )

        egrun1 = EmailGameRuns.objects.create(
            email=email,
            game_run=gamerun,
            player_answer=True
        )

        egrun2 = EmailGameRuns.objects.create(
            email=email,
            game_run=gamerun,
            player_answer=True
        )

        self.assertEqual(egrun1.order, 1)
        self.assertEqual(egrun2.order, 2)

