import datetime
from django.test import TestCase
from django.test.client import Client

from apps.pages.models import Page, Page_translation


class SitemapTestView(TestCase):
    def setUp(self):
        some_page = Page.objects.create(id=1,
        slug='index',
        color='#FDA132',
        photo='images/photo.png',
        sortorder=10,
        status=Page.STATUS_PUBLISHED,
        ptype=Page.PTYPE_MENU,
        updated_at=datetime.datetime.now(),
        created_at=datetime.datetime.now())

        Page_translation.objects.create(id=1,
        page=some_page,
        lang='en',
        menu='Main',
        col_central='lorem ipsum',
        col_bottom_1='lorem ipsum',
        col_bottom_2='lorem ipsum',
        col_bottom_3='lorem ipsum',
        meta_title='Welcome!',
        meta_description='This is mane page!',
        meta_keywords='Python3, Django',
        photo_alt='',
        photo_description='',
        updated_at=datetime.datetime.now(),
        created_at=datetime.datetime.now())

        self._client = Client()
        self.response = self._client.get('/Sitemap.xml', HTTP_HOST="testdomain.com")

    def test_sitemap(self):
        self.assertEqual(self.response.status_code, 200)

    def test_item_index(self):
        self.assertIn(b'index.html', self.response.content)

@@ -85,936 +85,113 @@
 nt%0A%0A
-from apps.pages.models import Page, Page_translation%0A%0A%0Aclass SitemapTestView(TestCase):%0A    def setUp(self):%0A        some_page = Page.objects.create(id=1,%0A        slug='index',%0A        color='#FDA132',%0A        photo='images/photo.png',%0A        sortorder=10,%0A        status=Page.STATUS_PUBLISHED,%0A        ptype=Page.PTYPE_MENU,%0A        updated_at=datetime.datetime.now(),%0A        created_at=datetime.datetime.now())%0A%0A        Page_translation.objects.create(id=1,%0A        page=some_page,%0A        lang='en',%0A        menu='Main',%0A        col_central='lorem ipsum',%0A        col_bottom_1='lorem ipsum',%0A        col_bottom_2='lorem ipsum',%0A        col_bottom_3='lorem ipsum',%0A        meta_title='Welcome!',%0A        meta_description='This is mane page!',%0A        meta_keywords='Python3, Django',%0A        photo_alt='',%0A        photo_description='',%0A        updated_at=datetime.datetime.now(),%0A        created_at=datetime.datetime.now())%0A
+%0Aclass SitemapTestView(TestCase):%0A    fixtures = %5B'apps/pages/fixtures/pages.json'%5D%0A%0A    def setUp(self):
 %0A   

use fixtures