コード例 #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
コード例 #2
0
ファイル: test_utils.py プロジェクト: CryptArc/liberapay.com
 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
コード例 #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
コード例 #4
0
ファイル: test_utils.py プロジェクト: CryptArc/liberapay.com
 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'
コード例 #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'
コード例 #6
0
ファイル: test_utils.py プロジェクト: kvaghel1/liberapay.com
 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'
コード例 #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
コード例 #8
0
ファイル: test_utils.py プロジェクト: astiob/liberapay.com
 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
コード例 #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)
コード例 #10
0
ファイル: test_utils.py プロジェクト: CryptArc/liberapay.com
 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
コード例 #11
0
ファイル: test_utils.py プロジェクト: liberapay/liberapay.com
 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
コード例 #12
0
ファイル: test_utils.py プロジェクト: liberapay/liberapay.com
 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