Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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'
Beispiel #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'
Beispiel #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'
Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #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
Beispiel #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
Beispiel #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