test_models.py 1.57 KB
Newer Older
1
2
3
# Future Imports
from __future__ import unicode_literals, absolute_import, print_function, division

David Haynes's avatar
David Haynes committed
4
# Django Imports
David Haynes's avatar
David Haynes committed
5
from django.test import TestCase
6
from django.contrib.auth.models import User
David Haynes's avatar
David Haynes committed
7

David Haynes's avatar
David Haynes committed
8
9
# App Imports
from go.models import URL, RegisteredUser
David Haynes's avatar
David Haynes committed
10

David Haynes's avatar
David Haynes committed
11
12
"""
    Test cases for the RegisteredUser Model
13
14
15
16
17
18

    - check approval and registration status flipping
    - check blocking
    - add in description
    - check organization field
    - check full name field
David Haynes's avatar
David Haynes committed
19
20
21
"""
class RegisteredUserTest(TestCase):

22
23
    def setUp(self):
        User.objects.create(username='dhaynes', password='password')
24
25
26
27
    
    """
        check if RegisteredUsers are actually made
    """
28
29
30
31
    def test_RegisteredUserCreation(self):
        getUser = User.objects.get(username='dhaynes')
        getRegisteredUser = RegisteredUser.objects.get(user=getUser)
        self.assertTrue(getRegisteredUser)
32
33
34
35
    
    """
        - check printing
    """
36
    def test_checkPrint(self):
37
38
39
40
41
        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)
David Haynes's avatar
David Haynes committed
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
    Test cases for the URL Model

    - check if URL's are actually created
    - modify clicks (social, qr, normal)
    - check expiration date creation
    - check print function
"""
class URLTest(TestCase):

    """
        Default test case, does not actually test anything
    """
    def test_Django_Test(self):
        self.assertEqual("Hello World!", "Hello World!")