sve radi
This commit is contained in:
parent
279c7df84a
commit
3328c6af3b
Binary file not shown.
@ -1,60 +1,3 @@
|
||||
# from django.test import TestCase
|
||||
# from django.contrib.gis.geos import Point
|
||||
# from django.urls import reverse
|
||||
# from rest_framework import status
|
||||
# from rest_framework.test import APITestCase
|
||||
# from plovidba_aplikacija.models import ObjektSigurnosti
|
||||
|
||||
|
||||
# # Testiranje listanja objekata
|
||||
# class ObjektSigurnostiListTest(APITestCase):
|
||||
# def test_list_objekti_sigurnosti(self):
|
||||
# url = reverse('objektisigurnosti-list')
|
||||
# response = self.client.get(url)
|
||||
|
||||
# self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
# # Testiranje stvaranja objekata
|
||||
# class ObjektSigurnostiCreateTest(APITestCase):
|
||||
# def setUp(self):
|
||||
# self.url = reverse('objektisigurnosti-list')
|
||||
|
||||
# def test_create_objekt_sigurnosti(self):
|
||||
# data = {
|
||||
# 'lokacija': {'lat': 45.123, 'lon': 18.456},
|
||||
# 'naziv': 'test-naziv',
|
||||
# }
|
||||
# response = self.client.post(self.url, data, format='json')
|
||||
# self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
# self.assertTrue(ObjektSigurnosti.objects.filter(naziv='test-naziv').exists())
|
||||
|
||||
|
||||
# # Testiranje dohvaćanja pojedinog objekata
|
||||
# class ObjektSigurnostiDetailTest(APITestCase):
|
||||
# def setUp(self):
|
||||
# self.objekt = ObjektSigurnosti.objects.create(
|
||||
# lokacija=Point(18.456, 45.123),
|
||||
# naziv='test-naziv',
|
||||
# )
|
||||
# self.url = reverse('objektisigurnosti-detail', args=[self.objekt.pk])
|
||||
|
||||
|
||||
# def test_get_objekt_sigurnosti(self):
|
||||
# response = self.client.get(self.url)
|
||||
# self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
# def test_update_objekt_sigurnosti(self):
|
||||
# data = {
|
||||
# 'lokacija': {'type': 'Point', 'coordinates': [45.123,18.456]},
|
||||
# 'naziv' : 'updated-naziv',
|
||||
|
||||
# }
|
||||
# response = self.client.patch(self.url, data, format='json')
|
||||
# self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
from django.contrib.gis.geos import Point
|
||||
from django.urls import reverse
|
||||
|
||||
Binary file not shown.
@ -1,65 +1,3 @@
|
||||
# from django.test import TestCase
|
||||
from django.test import TestCase
|
||||
|
||||
# from django.urls import reverse
|
||||
# from rest_framework import status
|
||||
# from rest_framework.test import APITestCase
|
||||
# from user.models import Organization, User
|
||||
# from user.views import user_delete, change_password
|
||||
|
||||
|
||||
|
||||
# class UserApiTestCase(APITestCase):
|
||||
|
||||
# def setUp(self):
|
||||
|
||||
# self.organization = Organization.objects.create(name="test organization")
|
||||
|
||||
# self.user01 = User.objects.create(
|
||||
# username="user01",
|
||||
# email="test@example.com",
|
||||
# first_name="User",
|
||||
# last_name="01",
|
||||
# organization=self.organization
|
||||
# )
|
||||
# self.user01.set_password('test1234')
|
||||
|
||||
# self.user02 = User.objects.create(
|
||||
# username="user02",
|
||||
# email="test02@example.com",
|
||||
# first_name="User",
|
||||
# last_name="02",
|
||||
# organization=self.organization
|
||||
# )
|
||||
|
||||
# def test_user_delete_forbidden(self):
|
||||
# self.client.force_authenticate(self.user02)
|
||||
# url = reverse("user_delete", kwargs={"pk": self.user01.id})
|
||||
# response = self.client.delete(url)
|
||||
# self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# def test_user_delete_success(self):
|
||||
# self.client.force_authenticate(self.user01)
|
||||
# url = reverse("user_delete", kwargs={"pk": self.user01.id})
|
||||
# response = self.client.delete(url)
|
||||
# self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||
|
||||
# def test_user_password_change_bad_request(self):
|
||||
# self.client.force_authenticate(self.user01)
|
||||
# url = reverse("change_password")
|
||||
# data = {'old_password': 'wrong-paasword', 'new_password': 'pass1234'}
|
||||
# response = self.client.put(url, data=data)
|
||||
# self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
# def test_user_password_change_too_comon(self):
|
||||
# self.client.force_authenticate(self.user01)
|
||||
# url = reverse("change_password")
|
||||
# data = {'old_password': 'test1234', 'new_password': 'pass1234'}
|
||||
# response = self.client.put(url, data=data)
|
||||
# self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
# def test_user_password_change_success(self):
|
||||
# self.client.force_authenticate(self.user01)
|
||||
# url = reverse("change_password")
|
||||
# data = {'old_password': 'test1234', 'new_password': 'listlabs12'}
|
||||
# response = self.client.put(url, data=data)
|
||||
# self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
# Create your tests here.
|
||||
Loading…
x
Reference in New Issue
Block a user