some refactoring, added Package manager for removing code duplicates, added helpers module, basic tests layout
This commit is contained in:
		
							
								
								
									
										0
									
								
								euscanwww/euscanwww/models.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								euscanwww/euscanwww/models.py
									
									
									
									
									
										Normal file
									
								
							@@ -132,15 +132,15 @@ MIDDLEWARE_CLASSES = (
 | 
			
		||||
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
CACHE_MIDDLEWARE_SECONDS=3600
 | 
			
		||||
CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True
 | 
			
		||||
CACHE_MIDDLEWARE_SECONDS = 3600
 | 
			
		||||
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
 | 
			
		||||
 | 
			
		||||
ROOT_URLCONF = 'euscanwww.urls'
 | 
			
		||||
 | 
			
		||||
# Python dotted path to the WSGI application used by Django's runserver.
 | 
			
		||||
WSGI_APPLICATION = 'euscanwww.wsgi.application'
 | 
			
		||||
 | 
			
		||||
FORCE_SCRIPT_NAME=""
 | 
			
		||||
FORCE_SCRIPT_NAME = ""
 | 
			
		||||
 | 
			
		||||
TEMPLATE_DIRS = (
 | 
			
		||||
    os.path.join(SITE_ROOT, 'templates'),
 | 
			
		||||
@@ -166,6 +166,7 @@ INSTALLED_APPS = (
 | 
			
		||||
    # Uncomment the next line to enable admin documentation:
 | 
			
		||||
    # 'django.contrib.admindocs',
 | 
			
		||||
    'south',
 | 
			
		||||
    'euscanwww',
 | 
			
		||||
    'djeuscan',
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								euscanwww/euscanwww/tests.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								euscanwww/euscanwww/tests.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
"""
 | 
			
		||||
System tests for euscanwww
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from urllib import urlencode
 | 
			
		||||
 | 
			
		||||
from django.utils import unittest
 | 
			
		||||
from django.test.client import Client
 | 
			
		||||
from django.core.urlresolvers import reverse
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class SystemTestCase(unittest.TestCase):
 | 
			
		||||
    """
 | 
			
		||||
    Base class for system tests
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def setUp(self):
 | 
			
		||||
        self.client = Client()
 | 
			
		||||
 | 
			
		||||
    def get(self, url_name, *args, **kwargs):
 | 
			
		||||
        param = kwargs.pop("param", None)
 | 
			
		||||
        if param:
 | 
			
		||||
            url = "%s?%s" % (reverse(url_name, args=args, kwargs=kwargs),
 | 
			
		||||
                             urlencode(param))
 | 
			
		||||
        else:
 | 
			
		||||
            url = reverse(url_name, args=args, kwargs=kwargs)
 | 
			
		||||
        return self.client.get(url)
 | 
			
		||||
 | 
			
		||||
    def post(self, url_name, *args, **kwargs):
 | 
			
		||||
        data = kwargs.pop("data", {})
 | 
			
		||||
        url = reverse(url_name, args=args, kwargs=kwargs)
 | 
			
		||||
        return self.client.post(url, data)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class NavigationTest(SystemTestCase):
 | 
			
		||||
    """
 | 
			
		||||
    Test main pages
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def test_index(self):
 | 
			
		||||
        """
 | 
			
		||||
        Test index
 | 
			
		||||
        """
 | 
			
		||||
        response = self.get("index")
 | 
			
		||||
        self.assertEqual(response.status_code, 200)
 | 
			
		||||
		Reference in New Issue
	
	Block a user