Ejemplo n.º 1
0
    def test_get_query_fields_valid_only_field(self):
        def query_args_func(key):
            args = {"field": ["a", "a", "b", "c"]}
            return args.get(key, [])

        self.assertIsInstance(get_query_fields(query_args_func),
                              types.ListType)
        self.assertEqual(["a", "c", "b"], get_query_fields(query_args_func))
Ejemplo n.º 2
0
    def test_get_query_fields_valid_both(self):
        def query_args_func(key):
            args = {"field": ["a", "b", "c"], "nfield": ["d", "d", "e"]}
            return args.get(key, [])

        expected = {"a": True, "b": True, "c": True, "d": False, "e": False}

        self.assertIsInstance(get_query_fields(query_args_func),
                              types.DictionaryType)
        self.assertEqual(expected, get_query_fields(query_args_func))
Ejemplo n.º 3
0
    def test_get_query_fields_both_empty(self):
        def query_args_func(key):
            return []

        self.assertIsNone(get_query_fields(query_args_func))