Beispiel #1
0
 def test_edit_request_is_successful(self):
     user = get_user("org-user")
     organization = fixtures.get_organization(slug="foo")
     OrganizationMember.objects.create(user=user, organization=organization)
     request = utils.get_request("get", "/org/foo/edit/", user=user)
     response = views.organization_edit(request, "foo")
     eq_(response.status_code, 200)
     eq_(response.template_name, "organizations/object_edit.html")
     eq_(sorted(response.context_data.keys()), ["form", "object"])
     self._tear_down()
Beispiel #2
0
 def test_edit_request_is_successful(self):
     user = get_user('org-user')
     organization = fixtures.get_organization(slug='foo')
     OrganizationMember.objects.create(user=user, organization=organization)
     request = utils.get_request(
         'get', '/org/foo/edit/', user=user)
     response = views.organization_edit(request, 'foo')
     eq_(response.status_code, 200)
     eq_(response.template_name, 'organizations/object_edit.html')
     eq_(sorted(response.context_data.keys()),
         ['form', 'object'])
     self._tear_down()
Beispiel #3
0
 def test_edit_payload_is_successful(self):
     user = get_user("org-user")
     organization = fixtures.get_organization(slug="foo")
     OrganizationMember.objects.create(user=user, organization=organization)
     data = {"name": "New name", "bio": "Bio"}
     request = utils.get_request("post", "/org/foo/edit/", user=user, data=data)
     request._messages = utils.TestMessagesBackend(request)
     response = views.organization_edit(request, "foo")
     eq_(response.status_code, 302)
     eq_(response["Location"], organization.get_absolute_url())
     org = Organization.objects.get(slug="foo")
     eq_(org.name, "New name")
     eq_(org.bio, "Bio")
     self._tear_down()
Beispiel #4
0
 def test_edit_payload_is_successful(self):
     user = get_user('org-user')
     organization = fixtures.get_organization(slug='foo')
     OrganizationMember.objects.create(user=user, organization=organization)
     data = {
         'name': 'New name',
         'bio': 'Bio',
     }
     request = utils.get_request(
         'post', '/org/foo/edit/', user=user, data=data)
     request._messages = utils.TestMessagesBackend(request)
     response = views.organization_edit(request, 'foo')
     eq_(response.status_code, 302)
     eq_(response['Location'], organization.get_absolute_url())
     org = Organization.objects.get(slug='foo')
     eq_(org.name, 'New name')
     eq_(org.bio, 'Bio')
     self._tear_down()
Beispiel #5
0
 def test_view_requires_authentication(self):
     request = utils.get_request("get", "/org/foo/edit/", user=utils.get_anon_mock())
     response = views.organization_edit(request, "foo")
     eq_(response.status_code, 302)
     eq_(response["Location"], utils.get_login_url("/org/foo/edit/"))
Beispiel #6
0
 def test_view_requires_authentication(self):
     request = utils.get_request(
         'get', '/org/foo/edit/', user=utils.get_anon_mock())
     response = views.organization_edit(request, 'foo')
     eq_(response.status_code, 302)
     eq_(response['Location'], utils.get_login_url('/org/foo/edit/'))