from django.test import TestCase
from django.shortcuts import resolve_url

from MMTest.projects.models import Project
from MMTest.mathmodels.models import MathModel
from MMTest.mmtests.models import MMTest
from MMTest.core.tests.view_testing_utils import FormSuccessTestMixin


class DeleteTest(FormSuccessTestMixin, TestCase):
    def setUp(self):
        project = Project.objects.create(name='Projeto 1')
        mathmodel = MathModel.objects.create(
            project=project,
            name='Modelo 1',
            description='Descrição do Modelo 1')
        mmtest = MMTest.objects.create(
            mathmodel=mathmodel,
            name='Teste 1',
            description='Descrição do Teste 1',
        )

        self.response = self.client.post(resolve_url('mmtests:delete',
                                                     mmtest.pk))
        self.url = resolve_url('mathmodels:details',
                               mathmodel.pk)
        self.model_class = MMTest
        self.expected_num_objects = 0
