Example #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)
Example #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)
Example #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)
Example #4
0
 def test_get_url_query_function_str(self):
     query = ScriptAddonRouterForKodi.get_url_query('function1')
     self.assertEqual(query, 'f=function1')
Example #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)
Example #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)
Example #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)
Example #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, [])
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')
Example #14
0
 def test_get_url_query_callable(self):
     query = ScriptAddonRouterForKodi.get_url_query(self.function2)
     self.assertEqual(query, 'f=function2')