示例#1
0
 def test_params_all(self):
     query = utils.get_params(status='active', page=3, search='bash_')
     assert {
         'page': ['3'],
         'search': ['bash_'],
         'status': ['active']
     } == parse_qs(query)
 def test_params_all(self):
     query = utils.get_params(showPaused=False, page=3, search='bash_')
     self.assertEqual(
         {
             'page': ['3'],
             'search': ['bash_'],
             'showPaused': ['False']
         }, parse_qs(query))
 def test_params_showPaused(self, show_paused, hide_by_default,
                            expected_result):
     with conf_vars({
         ('webserver', 'hide_paused_dags_by_default'):
             str(hide_by_default)
     }):
         self.assertEqual(expected_result,
                          utils.get_params(showPaused=show_paused))
示例#4
0
 def test_params_all(self):
     query = utils.get_params(showPaused=False, page=3, search='bash_')
     self.assertEqual(
         {'page': ['3'],
          'search': ['bash_'],
          'showPaused': ['False']},
         parse_qs(query)
     )
示例#5
0
 def test_params_no_values(self):
     """Should return an empty string if no params are passed"""
     self.assertEqual('', utils.get_params())
 def test_params_none_and_zero(self):
     qs = utils.get_params(a=0, b=None)
     # The order won't be consistent, but that doesn't affect behaviour of a browser
     pairs = list(sorted(qs.split('&')))
     self.assertListEqual(['a=0', 'b='], pairs)
示例#7
0
 def test_params_showPaused_false(self):
     self.assertEqual('showPaused=False',
                      utils.get_params(showPaused=False))
示例#8
0
 def test_params_search(self):
     assert 'search=bash_' == utils.get_params(search='bash_')
示例#9
0
 def test_params_search(self):
     self.assertEqual('search=bash_',
                      utils.get_params(search='bash_'))
示例#10
0
 def test_params_showPaused_true(self):
     """Should detect True as default for showPaused"""
     self.assertEqual('',
                      utils.get_params(showPaused=True))
示例#11
0
 def test_params_no_values(self):
     """Should return an empty string if no params are passed"""
     self.assertEquals('', utils.get_params())
示例#12
0
 def test_params_all(self):
     """Should return params string ordered by param key"""
     self.assertEqual('page=3&search=bash_&showPaused=False',
                      utils.get_params(showPaused=False, page=3, search='bash_'))
示例#13
0
 def test_params_escape(self):
     self.assertEqual('search=%27%3E%22%2F%3E%3Cimg+src%3Dx+onerror%3Dalert%281%29%3E',
                      utils.get_params(search="'>\"/><img src=x onerror=alert(1)>"))
示例#14
0
 def test_params_search(self):
     self.assertEqual('search=bash_', utils.get_params(search='bash_'))
示例#15
0
 def test_params_all(self):
     """Should return params string ordered by param key"""
     self.assertEqual(
         'page=3&search=bash_&showPaused=False',
         utils.get_params(showPaused=False, page=3, search='bash_'))
示例#16
0
 def test_params_no_values(self):
     """Should return an empty string if no params are passed"""
     assert '' == utils.get_params()
示例#17
0
 def test_params_showPaused_true(self):
     """Should detect True as default for showPaused"""
     self.assertEqual('', utils.get_params(showPaused=True))
示例#18
0
 def test_params_none_and_zero(self):
     query_str = utils.get_params(a=0, b=None, c='true')
     # The order won't be consistent, but that doesn't affect behaviour of a browser
     pairs = list(sorted(query_str.split('&')))
     assert ['a=0', 'c=true'] == pairs
示例#19
0
 def test_params_showPaused_false(self):
     self.assertEqual('showPaused=False',
                      utils.get_params(showPaused=False))
示例#20
0
 def test_params_escape(self):
     assert 'search=%27%3E%22%2F%3E%3Cimg+src%3Dx+onerror%3Dalert%281%29%3E' == utils.get_params(
         search="'>\"/><img src=x onerror=alert(1)>")
示例#21
0
 def test_params_none_and_zero(self):
     qs = utils.get_params(a=0, b=None)
     # The order won't be consistent, but that doesn't affect behaviour of a browser
     pairs = list(sorted(qs.split('&')))
     self.assertListEqual(['a=0', 'b='], pairs)