reset password
This commit is contained in:
@@ -1,3 +1,56 @@
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
# Create your tests here.
|
||||
from django.contrib.auth.models import User
|
||||
from .models import Clientes
|
||||
|
||||
class ClientesTests(TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
test_user = User.objects.create_user(username='testuser1',password='Soluciones28@')
|
||||
test_user.save()
|
||||
|
||||
cls.cliente = Clientes.objects.create(
|
||||
RFC="SCT050708EB2",
|
||||
Nombre="Aduanasoft",
|
||||
Activo=True,
|
||||
#fecha_baja="2022-12-20",
|
||||
email="fjrodriguez28@gmail.com",
|
||||
conteo_mes=12,
|
||||
)
|
||||
|
||||
|
||||
def test_redirect_if_not_logged_in(self):
|
||||
response = self.client.get(reverse('index'))
|
||||
self.assertRedirects(response, '/accounts/login/?next=/')
|
||||
|
||||
def test_cliente_content(self):
|
||||
self.assertEqual(self.cliente.RFC,"SCT050708EB2")
|
||||
self.assertEqual(self.cliente.Nombre,"Aduanasoft")
|
||||
self.assertEqual(self.cliente.Activo,True)
|
||||
#self.assertEqual(self.cliente.fecha_baja,"2022-12-20")
|
||||
self.assertEqual(self.cliente.email,"fjrodriguez28@gmail.com")
|
||||
self.assertEqual(self.cliente.conteo_mes,12)
|
||||
|
||||
#test for login user view and contains client with RFC SCT...
|
||||
def test_cliente_login_cliente_listview(self):
|
||||
login = self.client.login(username='testuser1',password='Soluciones28@')
|
||||
response = self.client.get(reverse('index'))
|
||||
|
||||
self.assertEqual(str(response.context['user']), 'testuser1')
|
||||
|
||||
self.assertEqual(response.status_code,200)
|
||||
self.assertContains(response, "SCT050708EB2")
|
||||
self.assertTemplateUsed(response, "Clientes/index.html")
|
||||
|
||||
#---------------_APIs Views Tests
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APITestCase, APIClient
|
||||
|
||||
class APITests(APITestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
pass
|
||||
|
||||
def test_api_check_RFC(self):
|
||||
pass
|
||||
Reference in New Issue
Block a user