Learn how to test views in isolate (no URL routing or middleware).
- [Instructor] Test views.…In this video, we're going to learn…how to test our views in isolation.…We're also going to learn how to test helper functions…on our view classes.…We're going to learn how to test our view response object,…and how to test for failure on views.…Let's hop right into some code.…We'll start by opening up our test view file.…Just like with every test, first we import our test case.…We also import model mommy, but in this test,…we're also importing a test factory…in the django.urls reverse.…
The request factory we'll go over a little bit later.…Next, we're importing the view…that we're planning on testing, in this case the vote view,…and we're also importing the choice model…because we'll need it later, as well.…Just like with our model tests,…we've created a new class called test vote view…that inherits from test case.…We also have a set up function…that's very similar to the one…that we used to test our models, as well.…The main difference in this set up…is we've created a new self.factory variable…
- Extending class-based views
- Building a REST API
- Working with GraphQL
- Building a basic schema
- Optimizing your environment
- Working with Pipenv
- How Django handles testing
- Securing the Django admin
Skill Level Advanced
1. Advanced Class-Based Views
2. Building a REST API
Authentication with DRF6m 14s
3. GraphQL: An Alternative API
4. Optimizing Your Environment
5. Tests, Tests, Tests
6. Securing Django
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.