Пример #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)
Пример #2
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))
Пример #3
0
 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())
Пример #6
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)
Пример #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)