from django.test import TestCase
from django.urls import reverse

from .models import Team, Job


class GetViewsTest(TestCase):
    def test_index(self):
        """
        The get_index view.
        """
        url = reverse('main:index')
        response = self.client.get(url)
        self.assertContains(response, 'OK!Thess')
        self.assertContains(response, 'Συνεργάτης')
        self.assertContains(response, 'στα πρώτα βήματα')

    def test_about(self):
        """
        The get_about view.
        """
        url = reverse('main:about')
        response = self.client.get(url)
        self.assertContains(response, 'OK!Thess')
        self.assertContains(response, 'Σχετικά')


class TeamsViewTests(TestCase):
    def test_teams(self):
        """
        The get_teams view.
        """
        new_team = Team.objects.create(
            name = 'OK!Thess',
            description = 'The best team.',
            url = 'http://www.okthess.gr/',
            image_url = 'http://www.okthess.gr/logo.png',
        )
        url = reverse('main:teams')
        response = self.client.get(url)
        self.assertContains(response, 'OK!Thess')
        self.assertContains(response, 'Φιλοξενούμενες ομάδες')
        self.assertContains(response, new_team.name)
        self.assertContains(response, new_team.description)
        self.assertContains(response, new_team.url)

    def test_jobs(self):
        """
        The get_teams view.
        """
        new_team = Team.objects.create(
            name = 'OK!Thess',
            description = 'The best team.',
            url = 'http://www.okthess.gr/',
            image_url = 'http://www.okthess.gr/logo.png',
        )
        new_job = Job.objects.create(
            team = new_team,
            title = 'Web Developer',
            apply_url = 'http://www.okthess.gr/jobs',
        )
        url = reverse('main:teams')
        response = self.client.get(url)
        self.assertContains(response, 'OK!Thess')
        self.assertContains(response, 'Φιλοξενούμενες ομάδες')
        self.assertContains(response, new_job.title)
        self.assertContains(response, new_job.apply_url)

@@ -88,16 +88,43 @@
 eam, Job
+, Mentor, Meetup, Coworking
 %0A%0A%0Aclass
@@ -2177,12 +2177,1586 @@
 .apply_url)%0A
+%0A    def test_mentors(self):%0A        %22%22%22%0A        The get_teams view.%0A        %22%22%22%0A        new_mentor = Mentor.objects.create(%0A            name = 'Mentor name',%0A            description = 'The best mentor',%0A        )%0A        url = reverse('main:teams')%0A        response = self.client.get(url)%0A        self.assertContains(response, 'OK!Thess')%0A        self.assertContains(response, '%CE%A6%CE%B9%CE%BB%CE%BF%CE%BE%CE%B5%CE%BD%CE%BF%CF%8D%CE%BC%CE%B5%CE%BD%CE%B5%CF%82 %CE%BF%CE%BC%CE%AC%CE%B4%CE%B5%CF%82')%0A        self.assertContains(response, new_mentor.name)%0A        self.assertContains(response, new_mentor.description)%0A%0A    def test_meetups(self):%0A        %22%22%22%0A        The get_teams view.%0A        %22%22%22%0A        new_meetup = Meetup.objects.create(%0A            name = 'Node.js meetup',%0A            description = 'The best meetup',%0A        )%0A        url = reverse('main:teams')%0A        response = self.client.get(url)%0A        self.assertContains(response, 'OK!Thess')%0A        self.assertContains(response, '%CE%A6%CE%B9%CE%BB%CE%BF%CE%BE%CE%B5%CE%BD%CE%BF%CF%8D%CE%BC%CE%B5%CE%BD%CE%B5%CF%82 %CE%BF%CE%BC%CE%AC%CE%B4%CE%B5%CF%82')%0A        self.assertContains(response, new_meetup.name)%0A        self.assertContains(response, new_meetup.description)%0A%0A    def test_coworkings(self):%0A        %22%22%22%0A        The get_teams view.%0A        %22%22%22%0A        new_coworking = Coworking.objects.create(%0A            name = 'Coho',%0A            description = 'The best coworking',%0A        )%0A        url = reverse('main:teams')%0A        response = self.client.get(url)%0A        self.assertContains(response, 'OK!Thess')%0A        self.assertContains(response, '%CE%A6%CE%B9%CE%BB%CE%BF%CE%BE%CE%B5%CE%BD%CE%BF%CF%8D%CE%BC%CE%B5%CE%BD%CE%B5%CF%82 %CE%BF%CE%BC%CE%AC%CE%B4%CE%B5%CF%82')%0A        self.assertContains(response, new_coworking.name)%0A        self.assertContains(response, new_coworking.description)%0A

update tests with new models