Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Feat/60 update test auth (#61)
Browse files Browse the repository at this point in the history
* test(auth): Corregidos 11/12 test.

* test(auth): ya funcionan todos los test

* style: lint code

---------

Co-authored-by: lDrakohh <[email protected]>
  • Loading branch information
2 people authored and adrrf committed Apr 1, 2024
1 parent b7dcb46 commit af96c2d
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions user/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django.test import TestCase

from ocial.models import TypeClient
from .models import OcialUser, OcialClient
from django.contrib.auth.models import User
from rest_framework import status
Expand Down Expand Up @@ -32,7 +34,7 @@ def setUp(self):
djangoUser=self.user_2,
name="asjodbgfaodvhier",
identificationDocument="A12345678", # cif
typeClient=OcialClient.TypeClient.ARTIST,
typeClient=TypeClient.ARTIST.value,
defaultLatitude=40.7128,
defaultLongitude=-40.7128,
)
Expand All @@ -41,7 +43,7 @@ def setUp(self):
djangoUser=self.user_3,
name="A",
identificationDocument="X1234567A", # nie
typeClient=OcialClient.TypeClient.BAR_RESTAURANT,
typeClient=TypeClient.BAR_RESTAURANT.value,
defaultLatitude=40.7128,
defaultLongitude=0.0,
)
Expand All @@ -64,23 +66,23 @@ def setUp(self):
"email": "[email protected]",
"lastKnowLocLat": 40.7128,
"lastKnowLocLong": -40.7128,
"typesfavEventType": OcialUser.TypesfavEvent.MUSIC,
}
self.client_data = {
"password": "asjrfkuyllyllyly.1213",
"email": "[email protected]",
"username": "testclient",
"password": "testpassword",
"email": "[email protected]",
"name": "Test Client",
"identification_document": "09981078K",
"typeClient": OcialClient.TypeClient.ARTIST,
"default_latitude": 40.7128,
"default_longitude": -40.7128,
"name": "string",
"identificationDocument": "81616045Q",
"typeClient": "Small business",
"defaultLatitude": 0,
"defaultLongitude": 0,
"djangoUser": 0,
}

def testGetUsers(self):
self.list2 = [self.user1, self.user2, self.user3, self.user4]
self.assertEqual(self.list1, self.list2)
self.assertEqual(self.user4.typeClient, OcialClient.TypeClient.SMALL_BUSINESS)
self.assertEqual(self.user4.typeClient, TypeClient.SMALL_BUSINESS.value)

def testCreateUser(self):
response = self.client.post(
Expand Down Expand Up @@ -174,7 +176,7 @@ def testCreateClientInvalidData(self):
"email": "[email protected]",
# Missing name
"identification_document": "A12345678",
"typeClient": OcialClient.TypeClient.ARTIST,
"typeClient": TypeClient.ARTIST.value,
"default_latitude": 40.7128,
"default_longitude": -40.7128,
}
Expand Down Expand Up @@ -207,7 +209,6 @@ def testRegisterUserDuplicateUsername(self):
"email": "[email protected]",
"lastKnowLocLat": 40.0,
"lastKnowLocLong": 40.0,
"typesfavEventType": 1,
}
response = self.client.post(url, data, format="json")
self.assertEqual(response.status_code, status.HTTP_409_CONFLICT)

0 comments on commit af96c2d

Please sign in to comment.