Skip to content

Instantly share code, notes, and snippets.

@godfather68
Created July 12, 2021 13:54
Show Gist options
  • Save godfather68/8b1b7a19fae15781eb76add1d53b70f3 to your computer and use it in GitHub Desktop.
Save godfather68/8b1b7a19fae15781eb76add1d53b70f3 to your computer and use it in GitHub Desktop.
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(
'test@email.com',
'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