def test_get_participant_raises_404_for_missing_id(self): state = self.client.GET('/~/', return_after='dispatch_request_to_filesystem', want='state') with self.assertRaises(Response) as cm: utils.get_participant(state, restrict=False) r = cm.exception assert r.code == 404
def GxT(self, path): state = self.client.GET(path, return_after='handle_dispatch_exception', want='state') with self.assertRaises(Response) as cm: utils.get_participant(state, restrict=False) return cm.exception
def test_get_participant_canonicalizes_id_to_username(self): self.make_participant('alice') state = self.client.GET('/~1/?x=2', return_after='dispatch_request_to_filesystem', want='state') with self.assertRaises(Response) as cm: utils.get_participant(state, restrict=False) r = cm.exception assert r.code == 302 assert r.headers['Location'] == '/alice/?x=2'
def test_get_participant_canonicalizes(self): self.make_participant('alice') state = self.client.GET('/Alice/?foo=bar', return_after='handle_dispatch_exception', want='state') with self.assertRaises(Response) as cm: utils.get_participant(state, restrict=False) r = cm.exception assert r.code == 302 assert r.headers[b'Location'] == b'/alice/?foo=bar'
def test_get_participant_gets_participant_from_id(self): expected = self.make_participant('alice') state = self.client.POST('/~1/', return_after='handle_dispatch_exception', want='state') actual = utils.get_participant(state, restrict=False) assert actual == expected
def test_get_participant_gets_participant_from_id(self): expected = self.make_participant('alice') state = self.client.POST('/~1/', return_after='dispatch_request_to_filesystem', want='state') actual = utils.get_participant(state, restrict=False) assert actual == expected
def GxT(self, path): state = self.client.GET(path, return_after='dispatch_path_to_filesystem', want='state') try: participant = utils.get_participant(state, restrict=False) except Response as response: response.set_whence_raised() return response else: raise DidntRaiseResponse(participant)