import datetime

from django.test import TestCase
from django.utils import timezone

from .models import Question
from django.test import Client
from django.urls import reverse


class QuestionModelTests(TestCase):

    def test_was_published_recently_with_future_question(self):
        """
        was_published_recently() returns False for questions whose pub_date
        is in the future.
        """
        time = timezone.now() + datetime.timedelta(days=30)
        future_question = Question(pub_date=time)
        self.assertIs(future_question.was_published_recently(), False)

    # def test_StatusCode(self):
    #             self.checkStatusCode()

    # def checkStatusCode(self):
    #     client = Client()
    #     response = client.get(reverse('polls:index'))
    #     self.assertIs(response.status, '200')


class QuestionIndexViewTests(TestCase):

    def test_StatusCode(self):
        client = Client()
        response = client.get(reverse('polls:index'))
        self.assertIs(response.status_code, 200)
