some tests, urls now have a name

This commit is contained in:
volpino 2012-05-06 20:03:49 +02:00
parent 0ece4c04b2
commit 948c5b8c39
6 changed files with 49 additions and 31 deletions

View File

@ -30,3 +30,4 @@ class SystemTestCase(unittest.TestCase):
from test_models import * from test_models import *
from test_views import * from test_views import *
from test_charts import *

View File

@ -0,0 +1,15 @@
from euscanwww.djeuscan.tests import SystemTestCase
class ChartTests(SystemTestCase):
"""
Test main pages
"""
def test_statistics(self):
response = self.get("statistics")
self.assertEqual(response.status_code, 200)
def test_pie_versions(self):
response = self.get("chart", chart="pie-versions")
self.assertEqual(response.status_code, 200)

View File

@ -5,57 +5,59 @@ from feeds import PackageFeed, CategoryFeed, HerdFeed, MaintainerFeed, \
package_patterns = patterns('djeuscan.views', package_patterns = patterns('djeuscan.views',
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/feed/$', url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/feed/$',
PackageFeed(), name='package_feed'), PackageFeed(), name='package_feed'),
(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/$', 'package'), url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/$',
'package', name="package"),
) )
categories_patterns = patterns('djeuscan.views', categories_patterns = patterns('djeuscan.views',
(r'^(?P<category>[\w+][\w+.-]*)/(view/)?$', 'category'), url(r'^(?P<category>[\w+][\w+.-]*)/(view/)?$', 'category',
name="category"),
url(r'^(?P<category>[\w+][\w+.-]*)/feed/$', CategoryFeed(), url(r'^(?P<category>[\w+][\w+.-]*)/feed/$', CategoryFeed(),
name='category_feed'), name='category_feed'),
(r'^(?P<category>[\w+][\w+.-]*)/charts/(?P<chart>[\w\-]+).png$', url(r'^(?P<category>[\w+][\w+.-]*)/charts/(?P<chart>[\w\-]+).png$',
'chart_category'), 'chart_category', name="chart_category"),
(r'^$', 'categories'), url(r'^$', 'categories', name="categories"),
) )
herds_patterns = patterns('djeuscan.views', herds_patterns = patterns('djeuscan.views',
(r'^(?P<herd>[\@\{\}\w+.-]*)/(view/)?$', 'herd'), url(r'^(?P<herd>[\@\{\}\w+.-]*)/(view/)?$', 'herd', name="herd"),
url(r'^(?P<herd>[\@\{\}\w+.-]*)/feed/$', HerdFeed(), name='herd_feed'), url(r'^(?P<herd>[\@\{\}\w+.-]*)/feed/$', HerdFeed(), name='herd_feed'),
(r'^(?P<herd>[\@\{\}\w+.-]*)/charts/(?P<chart>[\w\-]+).png$', url(r'^(?P<herd>[\@\{\}\w+.-]*)/charts/(?P<chart>[\w\-]+).png$',
'chart_herd'), 'chart_herd', name="chart_herd"),
(r'^$', 'herds'), url(r'^$', 'herds', name="herds"),
) )
maintainers_patterns = patterns('djeuscan.views', maintainers_patterns = patterns('djeuscan.views',
(r'^(?P<maintainer_id>\d+)/(view/)?$', 'maintainer'), url(r'^(?P<maintainer_id>\d+)/(view/)?$', 'maintainer', name="maintainer"),
url(r'^(?P<maintainer_id>\d+)/feed/$', MaintainerFeed(), url(r'^(?P<maintainer_id>\d+)/feed/$', MaintainerFeed(),
name='maintainer_feed'), name='maintainer_feed'),
(r'^(?P<maintainer_id>\d+)/charts/(?P<chart>[\w\-]+).png$', url(r'^(?P<maintainer_id>\d+)/charts/(?P<chart>[\w\-]+).png$',
'chart_maintainer'), 'chart_maintainer', name="chart_maintainer"),
(r'^$', 'maintainers'), url(r'^$', 'maintainers', name="maintainers"),
) )
overlays_patterns = patterns('djeuscan.views', overlays_patterns = patterns('djeuscan.views',
(r'^(?P<overlay>[\w+][\w+.-]*)/(view/)?$', 'overlay'), url(r'^(?P<overlay>[\w+][\w+.-]*)/(view/)?$', 'overlay', name="overlay"),
(r'^$', 'overlays'), url(r'^$', 'overlays', name="overlays"),
) )
urlpatterns = patterns('djeuscan.views', urlpatterns = patterns('djeuscan.views',
# Global stuff # Global stuff
(r'^api/', include('djeuscan.api.urls')), url(r'^api/', include('djeuscan.api.urls')),
url(r'^$', 'index', name="index"), url(r'^$', 'index', name="index"),
url(r'^feed/$', GlobalFeed(), name='global_feed'), url(r'^feed/$', GlobalFeed(), name='global_feed'),
(r'^about/$', 'about'), url(r'^about/$', 'about', name="about"),
(r'^about/api$', 'api'), url(r'^about/api$', 'api', name="api"),
(r'^statistics/$', 'statistics'), url(r'^statistics/$', 'statistics', name="statistics"),
(r'^statistics/charts/(?P<chart>[\w\-]+).png$', 'chart'), url(r'^statistics/charts/(?P<chart>[\w\-]+).png$', 'chart', name="chart"),
(r'^world/$', 'world'), url(r'^world/$', 'world', name="world"),
(r'^world/scan/$', 'world_scan'), url(r'^world/scan/$', 'world_scan', name="world_scan"),
# Real data # Real data
(r'^categories/', include(categories_patterns)), url(r'^categories/', include(categories_patterns)),
(r'^herds/', include(herds_patterns)), url(r'^herds/', include(herds_patterns)),
(r'^maintainers/', include(maintainers_patterns)), url(r'^maintainers/', include(maintainers_patterns)),
(r'^overlays/', include(overlays_patterns)), url(r'^overlays/', include(overlays_patterns)),
(r'^package/', include(package_patterns)), url(r'^package/', include(package_patterns)),
) )

View File

@ -9,8 +9,8 @@ urlpatterns = patterns('',
# Uncomment the admin/doc line below to enable admin documentation: # Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
(r'^', include('djeuscan.urls')), url(r'^', include('djeuscan.urls')),
) )

View File

@ -13,7 +13,7 @@ settings.configure(
}, },
INSTALLED_APPS=['euscanwww', 'djeuscan'], INSTALLED_APPS=['euscanwww', 'djeuscan'],
ROOT_URLCONF='euscanwww.euscanwww.urls', ROOT_URLCONF='euscanwww.euscanwww.urls',
EUSCAN_ROOT=os.path.dirname(os.path.dirname(os.path.abspath(__file__))), EUSCAN_ROOT=os.path.join(dirname(dirname(abspath(__file__))), "euscanwww"),
) )

View File

@ -86,7 +86,7 @@ setup(
('master' if __version__ == '9999' else ('euscan-%s' % __version__)) ('master' if __version__ == '9999' else ('euscan-%s' % __version__))
), ),
install_requires=['Django==1.4', 'django-annoying', 'South', install_requires=['Django==1.4', 'django-annoying', 'South',
'django-piston', 'BeautifulSoup'], 'django-piston', 'BeautifulSoup', "matplotlib"],
package_dir={'': 'pym'}, package_dir={'': 'pym'},
packages=packages, packages=packages,
package_data={}, package_data={},