From d26dbee2567e6813b3c3af0fd15fbbe0b1d71ba1 Mon Sep 17 00:00:00 2001 From: Alexander-D-Karpov Date: Tue, 21 Jun 2022 11:37:18 +0300 Subject: [PATCH] added instructions, inited tests --- README.md | 11 +++++++++++ common/tests.py | 22 ++++++++++++++++++++++ game/tests.py | 3 --- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 common/tests.py diff --git a/README.md b/README.md index 529bcad..2737b16 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ # chess_rpg_backend Backend for chess rpg game + +### installation +```shell +$ python3 manage.py makemigrations & python3 manage.py migrate +$ docker run -p 6379:6379 -d redis:5 +``` + +### run +```shell +$ python3 manage.py runserver 0.0.0.0:8000 +``` \ No newline at end of file diff --git a/common/tests.py b/common/tests.py new file mode 100644 index 0000000..fe1f195 --- /dev/null +++ b/common/tests.py @@ -0,0 +1,22 @@ +from rest_framework.test import APITestCase +from django.urls import reverse +from rest_framework import status + + +class GetBasicTest(APITestCase): + def __init__(self, url): + super().__init__() + self._url = reverse(url) + + @property + def url(self): + return self._url + + @url.setter + def url(self, value): + self._url = reverse(value) + + def test_accessibility(self): + """Test if POST request is possible""" + response = self.client.post(self._url) + self.assertNotEqual(response, status.HTTP_404_NOT_FOUND) diff --git a/game/tests.py b/game/tests.py index 7ce503c..e69de29 100644 --- a/game/tests.py +++ b/game/tests.py @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here.