Ritu Singh
Problem:
I'm trying to write a test case for the movie site that I'm creating. I want to test the add_user method. Each time I call add_user() from my test method, it is created a user in my SQLite db and then returns as a fail that the user already exists.
Solution:
You have several options here:
Use >pytest teardown fixture to cleanup user on test complete
Remove user Esth on test launch if it exists
Create user with the >random name
Create new database on every test run
Suggested blogs:
>How to load static files using Nginx, Docker, and Django?
>How to tell Django "if anything in urlpatterns does not match the GET string?
>How can I browser to render links in streamed content in Django?
>Access the "model" attribute for a ListView in Django for template
>How to use a function to print S3 data to HTML using Django?