def test_fetch_profile_post_no_data_403(self): self.request.method = 'POST' ViewClass = ProfileFetchView.as_view() view = ViewClass(self.request) assert_equals(403, view.status_code)
def test_fetch_profile_post_no_data_403(self): self.request.method = "POST" ViewClass = ProfileFetchView.as_view() view = ViewClass(self.request) assert_equals(403, view.status_code)
def test_fetch_profile_post_good_data_200(self): self.valid_site.secret = ENTREE['SECRET_KEY'] self.valid_site.save() fetcher = EntreeUserFetcherMixin() token = self.user.create_token() fetch_params = fetcher._fetch_params(token.value) self.request.method = 'POST' self.request.POST = fetch_params ViewClass = ProfileFetchView.as_view() view = ViewClass(self.request) assert_equals(200, view.status_code)
def test_fetch_profile_post_good_data_200(self): self.valid_site.secret = ENTREE["SECRET_KEY"] self.valid_site.save() fetcher = EntreeUserFetcherMixin() token = self.user.create_token() fetch_params = fetcher._fetch_params(token.value) self.request.method = "POST" self.request.POST = fetch_params ViewClass = ProfileFetchView.as_view() view = ViewClass(self.request) assert_equals(200, view.status_code)
def test_fetch_profile_invalid_checksum_403(self): self.valid_site.secret = ENTREE['SECRET_KEY'] self.valid_site.save() fetcher = EntreeUserFetcherMixin() token = self.user.create_token() fetch_params = fetcher._fetch_params(token.value) fetch_params['checksum'] = 'foo' self.request.method = 'POST' self.request.POST = fetch_params ViewClass = ProfileFetchView.as_view() view = ViewClass(self.request) assert_equals(403, view.status_code)
def test_fetch_profile_invalid_checksum_403(self): self.valid_site.secret = ENTREE["SECRET_KEY"] self.valid_site.save() fetcher = EntreeUserFetcherMixin() token = self.user.create_token() fetch_params = fetcher._fetch_params(token.value) fetch_params["checksum"] = "foo" self.request.method = "POST" self.request.POST = fetch_params ViewClass = ProfileFetchView.as_view() view = ViewClass(self.request) assert_equals(403, view.status_code)
def test_fetch_profile_get_request_405(self): ViewClass = ProfileFetchView.as_view() view = ViewClass(self.request) assert_equals(405, view.status_code)
from django.conf.urls import patterns, url from django.views.decorators.csrf import csrf_exempt from entree.site.views import ProfileView, ProfileFetchView, ProfileEdit urlpatterns = patterns( 'entree.site.views', url(r'^edit/(?P<site_id>\d+)/(?P<next_url>[\w\d=]+)/$', ProfileEdit.as_view(), name='profile_edit'), url(r'^edit/(?P<site_id>\d+)/$', ProfileEdit.as_view(), name='profile_edit'), #used only to generate appropriate link in class ShowApiView url(r'^edit/$', ProfileEdit.as_view(), name='profile_edit'), url(r'^fetch/$', csrf_exempt(ProfileFetchView.as_view()), name='profile_fetch'), url(r'^$', ProfileView.as_view(), name='profile'))
from django.conf.urls import patterns, url from django.views.decorators.csrf import csrf_exempt from entree.site.views import ProfileView, ProfileFetchView, ProfileEdit urlpatterns = patterns('entree.site.views', url(r'^edit/(?P<site_id>\d+)/(?P<next_url>[\w\d=]+)/$', ProfileEdit.as_view(), name='profile_edit'), url(r'^edit/(?P<site_id>\d+)/$', ProfileEdit.as_view(), name='profile_edit'), #used only to generate appropriate link in class ShowApiView url(r'^edit/$', ProfileEdit.as_view(), name='profile_edit'), url(r'^fetch/$', csrf_exempt(ProfileFetchView.as_view()), name='profile_fetch'), url(r'^$', ProfileView.as_view(), name='profile') )