dimanche 19 avril 2020

Django Testing Existence of File as URL

I am trying to figure out how to test for existence of files as URLs in Django. The version below version produces a failure:

self.assertEqual(response.status_code, 200)
AssertionError: 302 != 200 

Here is the code for the test.

from django.test import Client 
from django.utils import translation

class ExistenceTest(TestCase):
    def test_static_css_directory_exists(self):
        C = Client()
        response = C.get('/static/css/clean-blog.min.css')
        self.assertEqual(response.status_code, 200)

Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire