def test_user_redirected_if_method_get(self): self.open_workspace() self.request.method = 'GET' self.request.form = {'button.join': True} self.request['HTTP_REFERER'] = 'someurl' self.login('demo') view = JoinView(self.workspace, self.request) response = view() self.assertEqual('someurl', response) self.assertNotIn('demo', IWorkspace(self.workspace).members)
def test_user_redirected_to_workspace_if_no_referer(self): self.open_workspace() self.login('demo') view = JoinView(self.workspace, self.request) response = view() self.assertEqual(self.workspace.absolute_url(), response)
def test_user_cant_join_if_policy_is_not_self(self): self.login('demo') view = JoinView(self.workspace, self.request) self.assertRaises(Unauthorized, view)