I have a flatpage in my website. I created it by writing this:
urlpatterns = [
path('admin/', admin.site.urls),
path('facts/', include('django.contrib.flatpages.urls')),]
After that in admin page I created a page about-me, so the whole url for that page is ‘localhost/facts/about-me/’
I tried to write test for this page:
class StaticURLTests(TestCase):
def setUp(self):
self.guest_client = Client()
def test_about_author(self):
response = self.guest_client.get('/facts/about-me/')
self.assertEqual(response.status_code, 200)
But I get the following error:
self.assertEqual(response.status_code, 200)
AssertionError: 404 != 200
FAILED (failures=1)
Destroying test database for alias ‘default’…
Can’t figure out why. Maybe smb was facing the same problem