コード例 #1
0
 def testNonAsciiQuery(self):
     path = make_url(HOME, q='g \xc3\xb4\xc3\xb6\xc3\xb2')
     location = make_url(
         'https://www.google.com/search',
         q='\xc3\xb4\xc3\xb6\xc3\xb2',
     )
     self.get(path, redirect=location)
コード例 #2
0
    def testSignedInUser(self):
        commands = [
            get_dummy_command(name='a', url_pattern='https://{1}{2}.com'),
        ]
        self.tc.signInUser(make_dummy_user(commands=commands))

        path = make_url(HOME, q='a b c')
        self.get(path, redirect='https://bc.com')

        path = make_url(HOME, q='another query')
        self.get(
            path,
            template='command_error.html',
            contains='Unknown command',
        )
コード例 #3
0
 def testMissingArguments(self):
     path = make_url(HOME, q='cron *')
     self.get(
         path,
         template='command_error.html',
         contains='Not enough arguments',
     )
コード例 #4
0
 def testBadDefaultQuery(self):
     path = make_url(HOME, q='hello world', default='bye')
     self.get(
         path,
         template='command_error.html',
         contains='Unknown default command',
     )
コード例 #5
0
 def testGoodQueryWithBadDefault(self):
     path = make_url(HOME, q='g hello', default='bye')
     location = make_url('https://www.google.com/search', q='hello')
     self.get(path, redirect=location)
コード例 #6
0
 def testMalformedQuery(self):
     path = make_url(HOME, q='')
     self.get(path, redirect='http://localhost' + HOME)
コード例 #7
0
 def testGoodDefaultQuery(self):
     path = make_url(HOME, q='hello world', default='g')
     location = make_url('https://www.google.com/search', q='hello world')
     self.get(path, redirect=location)