Exemplo n.º 1
0
 def test_get_and_parse_url_query_arg_tuple(self):
     value = (123, 123.4, True, 'abc')
     query = ScriptAddonRouterForKodi.get_url_query(self.function2, value)
     func_str, args = ScriptAddonRouterForKodi.parse_url_query(query)
     self.assertEqual(func_str, 'function2')
     self.assertEqual(type(args[0]), type(value))
     self.assertEqual(args[0], value)
Exemplo n.º 2
0
 def test_get_and_parse_url_query_arg_dict(self):
     value = {'key0': 123, 'elem1': 123.4, 'arg2': True, 'index3': 'abc'}
     query = ScriptAddonRouterForKodi.get_url_query(self.function2, value)
     func_str, args = ScriptAddonRouterForKodi.parse_url_query(query)
     self.assertEqual(func_str, 'function2')
     self.assertEqual(type(args[0]), type(value))
     self.assertEqual(args[0], value)
Exemplo n.º 3
0
 def test_parse_url_query_args(self):
     query = 'f=function1&0=i123&1=f123.4&2=bTrue&3=sabc'
     func_str, args = ScriptAddonRouterForKodi.parse_url_query(query)
     self.assertEqual(func_str, 'function1')
     self.assertEqual(args, [123, 123.4, True, 'abc'])
     self.assertEqual(type(args[0]), int)
     self.assertEqual(type(args[1]), float)
     self.assertEqual(type(args[2]), bool)
     self.assertEqual(type(args[3]), str)
Exemplo n.º 4
0
 def test_get_url_query_function_str(self):
     query = ScriptAddonRouterForKodi.get_url_query('function1')
     self.assertEqual(query, 'f=function1')
Exemplo n.º 5
0
 def test_parse_url_query_arg_str(self):
     query = 'f=function1&0=sabc'
     func_str, args = ScriptAddonRouterForKodi.parse_url_query(query)
     self.assertEqual(func_str, 'function1')
     self.assertEqual(args, ['abc'])
     self.assertEqual(type(args[0]), str)
Exemplo n.º 6
0
 def test_parse_url_query_arg_bool(self):
     query = 'f=function1&0=bTrue'
     func_str, args = ScriptAddonRouterForKodi.parse_url_query(query)
     self.assertEqual(func_str, 'function1')
     self.assertEqual(args, [True])
     self.assertEqual(type(args[0]), bool)
Exemplo n.º 7
0
 def test_parse_url_query_arg_float(self):
     query = 'f=function1&0=f123.4'
     func_str, args = ScriptAddonRouterForKodi.parse_url_query(query)
     self.assertEqual(func_str, 'function1')
     self.assertEqual(args, [123.4])
     self.assertEqual(type(args[0]), float)
Exemplo n.º 8
0
 def test_parse_url_query_function(self):
     query = 'f=function1'
     func_str, args = ScriptAddonRouterForKodi.parse_url_query(query)
     self.assertEqual(func_str, 'function1')
     self.assertEqual(args, [])
Exemplo n.º 9
0
 def test_get_url_query_args(self):
     query = ScriptAddonRouterForKodi.get_url_query(self.function2, 123,
                                                    123.4, True, "abc")
     self.assertEqual(query, 'f=function2&0=i123&1=f123.4&2=bTrue&3=sabc')
Exemplo n.º 10
0
 def test_get_url_query_arg_str(self):
     query = ScriptAddonRouterForKodi.get_url_query(self.function2, "abc")
     self.assertEqual(query, 'f=function2&0=sabc')
Exemplo n.º 11
0
 def test_get_url_query_arg_bool(self):
     query = ScriptAddonRouterForKodi.get_url_query(self.function2, True)
     self.assertEqual(query, 'f=function2&0=bTrue')
Exemplo n.º 12
0
 def test_get_url_query_arg_float(self):
     query = ScriptAddonRouterForKodi.get_url_query(self.function2, 123.4)
     self.assertEqual(query, 'f=function2&0=f123.4')
Exemplo n.º 13
0
 def test_get_url_query_arg_int(self):
     query = ScriptAddonRouterForKodi.get_url_query(self.function2, 123)
     self.assertEqual(query, 'f=function2&0=i123')
Exemplo n.º 14
0
 def test_get_url_query_callable(self):
     query = ScriptAddonRouterForKodi.get_url_query(self.function2)
     self.assertEqual(query, 'f=function2')