55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
# coding=UTF-8
|
|
|
|
from django.urls import reverse
|
|
from django.test import TestCase, Client
|
|
|
|
from .models import Routine_Skill, Routine, Skill, TouchPosition
|
|
from .views import link_skill_to_routine
|
|
|
|
|
|
class RoutineTest(TestCase):
|
|
def setUp(self):
|
|
self.routine, routine_created = Routine.objects.get_or_create(
|
|
longLabel="Routine test",
|
|
shortLabel="Routine test",
|
|
difficulty=0,
|
|
active=True,
|
|
)
|
|
(
|
|
self.touch_position,
|
|
touch_position_created,
|
|
) = TouchPosition.objects.get_or_create(
|
|
longLabel="Touch test",
|
|
shortLabel="Touch test",
|
|
competition=True,
|
|
default=True,
|
|
)
|
|
self.skill, skill_created = Skill.objects.get_or_create(
|
|
longLabel="Skill test",
|
|
shortLabel="Skill test",
|
|
difficulty=0,
|
|
position=1,
|
|
departure=self.touch_position,
|
|
landing=self.touch_position,
|
|
rotationType=1,
|
|
rotation=0,
|
|
twist=0,
|
|
notation="T",
|
|
simplyNotation="t",
|
|
)
|
|
self.client = Client()
|
|
self.url_details = {
|
|
"routineid": self.routine.id,
|
|
"skillid": self.skill.id,
|
|
"order": 1,
|
|
}
|
|
|
|
def test_valid_link_skill_to_routine(self):
|
|
c = Client()
|
|
url = reverse("link_skill_to_routine", kwargs=self.url_details)
|
|
response = c.get(url)
|
|
|
|
# print(response)
|
|
self.assertEquals(response.status_code, 200)
|
|
self.assertTrue(Routine_Skill.objects.exists())
|