Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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'
Exemplo n.º 5
0
 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'
Exemplo n.º 6
0
 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'
Exemplo n.º 7
0
 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
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 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
Exemplo n.º 11
0
 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
Exemplo n.º 12
0
 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