Unverified Commit e2b74ba0 authored by David Haynes's avatar David Haynes
Browse files

Test the registereduser description field

- if text can be input
- or can be blank
parent c6b66037
Pipeline #1073 passed with stage
in 1 minute and 1 second
......@@ -8,38 +8,64 @@ from django.contrib.auth.models import User
# App Imports
from go.models import URL, RegisteredUser
"""
Test cases for the RegisteredUser Model
- check approval and registration status flipping
- check blocking
- add in description
- check organization field
- check full name field
"""
class RegisteredUserTest(TestCase):
"""
Test cases for the RegisteredUser Model
- check approval and registration status flipping
- check blocking
- check organization field
- check full name field
"""
def setUp(self):
"""
Set up any variables such as dummy objects that will be utilised in
testing methods
"""
User.objects.create(username='dhaynes', password='password')
"""
check if RegisteredUsers are actually made
"""
def test_RegisteredUserCreation(self):
def test_registereduser_creation(self):
"""
check if RegisteredUsers are actually made
"""
getUser = User.objects.get(username='dhaynes')
getRegisteredUser = RegisteredUser.objects.get(user=getUser)
self.assertTrue(getRegisteredUser)
"""
- check printing
"""
def test_checkPrint(self):
def test_check_str(self):
"""
check printing
"""
getUser = User.objects.get(username='dhaynes')
getRegisteredUser = RegisteredUser.objects.get(user=getUser)
expected = '<Registered User: dhaynes - Approval Status: False>'
actual = str(getRegisteredUser)
self.assertEqual(expected, actual)
def test_description_blank(self):
"""
- add in description (blank)
"""
getUser = User.objects.get(username='dhaynes')
getRegisteredUser = RegisteredUser.objects.get(user=getUser)
self.assertEqual(getRegisteredUser.description, "")
def test_description_text(self):
"""
- add in description
"""
getUser = User.objects.get(username='dhaynes')
getRegisteredUser = RegisteredUser.objects.get(user=getUser)
getRegisteredUser.description = "We're going to build a big beautiful testcase"
self.assertEqual(getRegisteredUser.description, "We're going to build a big beautiful testcase")
"""
Test cases for the URL Model
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment