Skip to content
Snippets Groups Projects
Commit 1f88dd39 authored by Sigurd's avatar Sigurd
Browse files

Added test to validate pw

parent 7b0515d8
No related branches found
No related tags found
No related merge requests found
Pipeline #170718 failed
from threading import local
from django.test import TestCase, RequestFactory, Client
from users.models import User
from django.test import TestCase
from users.serializers import UserSerializer
from rest_framework import serializers
# Create your tests here.
class UserSerializerTestCase(TestCase):
# def setUp(self):
#anything?
def test_validate_password(self):
print("User tests")
my_pass = "pw"
local_seri = UserSerializer(data={"password": my_pass, "password1": my_pass})
self.assertEqual(local_seri.validate_password(my_pass), my_pass)
def test_invalid_password(self):
my_pass = "pw"
invalid_pass = "hehe"
local_seri = UserSerializer(data={"password": my_pass, "password1": invalid_pass})
self.assertRaises(serializers.ValidationError, local_seri.validate_password, my_pass)
def test_create(self):
username = "jorsi"
email = "some@mail.com"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment