コード例 #1
0
 def test_get_logins(self):
     for cookie, expected in (
         ('', []),
         ('abc=xyz', []),
         ('logins=', []),
         ('logins=|', []),
         ('logins=/fake/123', [Login('fake', '', '/fake/123')]),
         ('logins=/fake/123?Name', [Login('fake', 'Name', '/fake/123')]),
         ('logins=/fake/123?Name|/blogger/456?Nombre', [
             Login('fake', 'Name', '/fake/123'),
             Login('blogger', 'Nombre', '/blogger/456'),
         ]),
     ):
         self.request.headers['Cookie'] = cookie
         self.assertItemsEqual(expected, self.handler.get_logins())
コード例 #2
0
 def test_logins_cookie_url_decode(self):
     """https://console.cloud.google.com/errors/10588536940780707768?project=brid-gy"""
     with app.test_request_context(
             headers={'Cookie': 'logins="/fake/123?question%3Fmark"'}):
         self.assertEqual(
             [Login(site='fake', name='question?mark', path='/fake/123')],
             util.get_logins())
コード例 #3
0
 def test_get_logins(self):
     for cookie, expected in (
         ('', []),
         ('abc=xyz', []),
         ('logins=', []),
         ('logins=|', []),
         ('logins=/fake/123', [Login('fake', '', '/fake/123')]),
         ('logins=/fake/123?Name', [Login('fake', 'Name', '/fake/123')]),
         ('logins=/fake/123?a%E2%98%95b',
          [Login('fake', 'a☕b', '/fake/123')]),
         ('logins=/fake/123?Name|/blogger/456?Nombre', [
             Login('fake', 'Name', '/fake/123'),
             Login('blogger', 'Nombre', '/blogger/456'),
         ]),
     ):
         with app.test_request_context(headers={'Cookie': cookie}):
             self.assertCountEqual(expected, util.get_logins())
コード例 #4
0
ファイル: test_util.py プロジェクト: muhammedsansal/bridgy
 def test_logins_cookie_url_decode(self):
     """https://console.cloud.google.com/errors/10588536940780707768?project=brid-gy"""
     self.request.headers['Cookie'] = 'logins="/fake/123?question%3Fmark"'
     self.assertEquals(
         [Login(site='fake', name='question?mark', path='/fake/123')],
         self.handler.get_logins())