예제 #1
0
 def setUp(self):
     included_urlpatterns = patterns('tests',
         verb_url('GET',     '^test$', 'method_view'),
         verb_url('POST',    '^test$', 'method_view')
     )
     
     self.urlconf = URLConf(patterns('tests',
         verb_url('GET',     '^test$', 'method_view'),
         verb_url('POST',    '^test$', 'method_view'),
         verb_url('PUT',     '^test$', 'method_view'),
         verb_url('DELETE',  '^test$', 'method_view'),
         verb_url('GET',     '^kwarg', 'kwarg_view', {'key': 'get view'}),
         verb_url('POST',    '^kwarg', 'kwarg_view', {'key': 'post view'}),
         url('^include/', include(included_urlpatterns))
     ))
예제 #2
0
from reroute import handler404, handler500, patterns, url, include
from reroute.verbs import verb_url

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$',               'guples.views.home'),

    # Heroku-specific routes
	verb_url('POST',         r'^heroku/resources$',                        'guples.views.heroku_provision'),
	verb_url('DELETE',       r'^heroku/resources/(?P<id>[0-9].*)$',        'guples.views.heroku_deprovision'),
	verb_url('PUT',          r'^heroku/resources/(?P<id>[0-9].*)$',        'guples.views.heroku_planchange'),
	verb_url('GET',          r'^heroku/resources/(?P<id>[0-9].*)$',        'guples.views.heroku_sso_for_resource'),
	verb_url('POST',         r'^sso/login$',                               'guples.views.heroku_sso'),	
	verb_url('GET',          r'^heroku/ssolanding$',                       'guples.views.heroku_sso_landing'),
)
예제 #3
0
 def testURLWithDjangoPatternsShouldFail(self):
     urlconf = URLConf(django_patterns('tests',
         url('^test$', 'wrapper_view')
     ))
     
     self.assertRaises(ImproperlyConfigured, content, '/test', urlconf)
예제 #4
0
 def testWrapperOrder(self):       
     urlconf = URLConf(reroute_patterns([wrapper1, wrapper2], 'tests',
         url('^test$', 'wrapper_view')
     ))
     
     self.assertEqual(content('/test', urlconf), 'wrapper 1 2')
예제 #5
0
 def testReroutePatterns(self): 
     urlconf = URLConf(reroute_patterns([wrapper1], 'tests',
         url('^test$', 'wrapper_view')
     ))
        
     self.assertEqual(content('/test', urlconf), 'wrapper 1')
예제 #6
0
 def setUp(self):
     included_urlpatterns = patterns('tests',
         url('^included_view$', 'generic_view')
     )
     
     urlpatterns = patterns('tests',
         ('^tuple$', 'generic_view'),
         url('^url$', 'generic_view'),
         url('^non_string_view$', generic_view),
         url('^view_with_name$', 'generic_view', name='view_with_name'),
         url('^kwargs$', 'kwarg_view', kwargs={'key': 'value'}),
         url('^url_reverse$', 'view_one'),
         url('^non_string_view_reverse$', view_two),
         url('^view_with_name_reverse$', 'view_three', name='view_with_name_reverse'),
         url('^include/', include(included_urlpatterns)),
         url('^csrf_exempt_view$', csrf_exempt_view),
     )
     
     urlpatterns += patterns('',
         url('^prefix' , 'generic_view', prefix='tests'),
     )
     
     self.urlconf = URLConf(urlpatterns)
예제 #7
0
from reroute import handler404, handler500, patterns, url, include
from reroute.verbs import verb_url

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns(
    "",
    url(r"^$", "guples.views.home"),
    # Heroku-specific routes
    verb_url("POST", r"^heroku/resources$", "guples.views.heroku_provision"),
    verb_url("DELETE", r"^heroku/resources/(?P<id>[0-9].*)$", "guples.views.heroku_deprovision"),
    verb_url("PUT", r"^heroku/resources/(?P<id>[0-9].*)$", "guples.views.heroku_planchange"),
    verb_url("GET", r"^heroku/resources/(?P<id>[0-9].*)$", "guples.views.heroku_sso_for_resource"),
    verb_url("POST", r"^sso/login$", "guples.views.heroku_sso"),
    verb_url("GET", r"^heroku/ssolanding$", "guples.views.heroku_sso_landing"),
)