Created
July 12, 2021 13:54
-
-
Save godfather68/8b1b7a19fae15781eb76add1d53b70f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import test | |
from django.test import TestCase | |
from django.urls import reverse | |
from django.contrib.auth import get_user_model | |
from rest_framework import status | |
from rest_framework.test import APIClient | |
from core.models import House | |
from rental.serializers import HouseSerializer | |
class PublicHouseTestApi(TestCase): | |
"""Test the publicly available houses API""" | |
def setUp(self): | |
self.client = APIClient() | |
self.user = get_user_model().objects.create_user( | |
'[email protected]', | |
'password' | |
) | |
def test_access_houses_url(self): | |
"""Test for retrieving all the available houses""" | |
res = self.client.get(reverse('rental:house-list)) | |
self.assertEqual(res.status_code, status.HTTP_200_OK) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment