예제 #1
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)
예제 #2
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)
예제 #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)
예제 #4
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)
예제 #5
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)
예제 #6
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)
예제 #7
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, [])