Esempio 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
Esempio 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
Esempio 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
Esempio 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'
Esempio 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'
Esempio 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'
Esempio 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
Esempio 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
Esempio 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)
Esempio 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
Esempio 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
Esempio 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