added stubs for authentication and CRUD tests
							parent
							
								
									64b60d2ad1
								
							
						
					
					
						commit
						3cd05013ab
					
				@ -1,4 +1,4 @@
 | 
				
			|||||||
; config.ini
 | 
					# config.ini
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[user]
 | 
					[user]
 | 
				
			||||||
BCRYPT_LOG_ROUNDS : 13
 | 
					BCRYPT_LOG_ROUNDS : 13
 | 
				
			||||||
@ -1,21 +0,0 @@
 | 
				
			|||||||
from app import welcome
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
from apistar.test import TestClient
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def test_welcome():
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    Testing a view directly.
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    data = welcome()
 | 
					 | 
				
			||||||
    assert data == {'message': 'Welcome to API Star!'}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def test_http_request():
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    Testing a view, using the test client.
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    client = TestClient()
 | 
					 | 
				
			||||||
    response = client.get('http://localhost/')
 | 
					 | 
				
			||||||
    assert response.status_code == 200
 | 
					 | 
				
			||||||
    assert response.json() == {'message': 'Welcome to API Star!'}
 | 
					 | 
				
			||||||
@ -0,0 +1,80 @@
 | 
				
			|||||||
 | 
					# JWT Token
 | 
				
			||||||
 | 
					def test_encode_auth_token():
 | 
				
			||||||
 | 
					    """Test JWT token encoding"""
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_decode_auth_token():
 | 
				
			||||||
 | 
					    """Test JWT token decode"""
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Register
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_registration():
 | 
				
			||||||
 | 
					    """ Test for user registration """
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_registered_with_already_registered_user():
 | 
				
			||||||
 | 
					    """ Test registration with already registered email"""
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_registered_user_login():
 | 
				
			||||||
 | 
					    """ Test for login of registered-user login """
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_non_registered_user_login():
 | 
				
			||||||
 | 
					    """ Test for login of non-registered user """
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Test Login
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_registered_user_login(self):
 | 
				
			||||||
 | 
					    """ Test for login of registered-user login """
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_non_registered_user_login():
 | 
				
			||||||
 | 
					    """ Test for login of non-registered user """
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Test Logout
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_valid_logout():
 | 
				
			||||||
 | 
					    """ Test for logout before token expires """
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_invalid_logout():
 | 
				
			||||||
 | 
					    """ Testing logout after the token expires """
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# User status
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_user_status():
 | 
				
			||||||
 | 
					    """ Test for user status """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"""In order to get the user details of the currently logged in user, the auth token must be sent with the request within the header."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_user_status_malformed_bearer_token():
 | 
				
			||||||
 | 
					    """ Test for user status with malformed bearer token"""
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Blacklist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_valid_blacklisted_token_logout():
 | 
				
			||||||
 | 
					    """ Test for logout after a valid token gets blacklisted """
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_valid_blacklisted_token_user(self):
 | 
				
			||||||
 | 
					    """ Test for user status with a blacklisted valid token """
 | 
				
			||||||
@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					# CRUD Cookies
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_get_cookies():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_get_cookie():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_valid_create_cookie():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_invalid_create_cookie():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_valid_update_cookie():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_invalid_update_cookie():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_delete_cookie():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue