Make sure you know how to use unitttest and pytest on Django before you start do
Make sure you know how to use unitttest and pytest on Django before you start doing these assignments.
Some files might be created some of them you have to create, just make sure you are using these instractions, send me back 2 separate files. You may have to create venv and install requirements
1st assignment is: YaNews
In the file test_routes.py:
The home page is accessible to anonymous users.
The page for an individual news article is accessible to anonymous users.
The comment deletion and editing pages are accessible to the author of the comment.
When an anonymous user attempts to access the comment editing or deletion page, they are redirected to the login page.
An authenticated user cannot access the editing or deletion pages for someone else’s comments (a 404 error is returned).
The user registration, login, and logout pages are accessible to anonymous users.
In the file test_content.py:
The number of news articles on the home page is no more than 10.
News articles are sorted from newest to oldest, with the latest news at the top of the list.
Comments on the individual news article page are sorted in chronological order: older comments are at the top of the list, and newer ones are at the bottom.
An anonymous user does not have access to the comment submission form on the individual news page, whereas an authenticated user does.
In the file test_logic.py:
An anonymous user cannot submit a comment.
An authenticated user can submit a comment.
If a comment contains prohibited words, it will not be published, and the form will return an error.
An authenticated user can edit or delete their own comments.
An authenticated user cannot edit or delete someone else’s comments.
2nd assignment is:
YaNote Tests for YaNote Project using unittest
In the file test_routes.py:
The home page is accessible to anonymous users.
The page with the list of notes (notes/), the successful note addition page (done/), and the new note addition page (add/) are accessible to authenticated users.
The pages for an individual note, deleting a note, and editing a note are only accessible to the author of the note. If another user tries to access these pages, a 404 error is returned.
When an anonymous user tries to access the page with the list of notes, the successful addition page, the note addition page, the individual note page, the edit page, or the delete page, they are redirected to the login page.
The user registration, login, and logout pages are accessible to all users.
In the file test_content.py:
An individual note is passed to the notes list page in the object_list within the context dictionary.
Notes from other users do not appear in the list of notes for a particular user.
Forms are passed to the note creation and editing pages.
In the file test_logic.py:
A logged-in user can create a note, but an anonymous user cannot.
It is not possible to create two notes with the same slug.
If a slug is not filled in when creating a note, it is generated automatically using the pytils.translit.slugify function.
A user can edit and delete their own notes but cannot edit or delete someone else’s notes.
The post Make sure you know how to use unitttest and pytest on Django before you start do appeared first on Succeed Papers.