This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
1 changed file
with
14 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
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 | ||
|
@@ -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, | ||
) | ||
|
@@ -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, | ||
) | ||
|
@@ -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( | ||
|
@@ -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, | ||
} | ||
|
@@ -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) |