示例#1
0
    def test_haystack_identifier_method(self):
        # The custom implementation returns the MD-5 hash of the key value by
        # default:
        get_identifier = _lookup_identifier_method()
        self.assertEqual(get_identifier("a.b.c"), "553f764f7b436175c0387e22b4a19213")

        # … but it also supports a custom override mechanism which would
        # definitely fail with the default implementation:
        class custom_id_class(object):
            def get_custom_haystack_id(self):
                return "CUSTOM"

        self.assertEqual(get_identifier(custom_id_class()), "CUSTOM")
示例#2
0
    def test_haystack_identifier_method(self):
        # The custom implementation returns the MD-5 hash of the key value by
        # default:
        get_identifier = _lookup_identifier_method()
        self.assertEqual(get_identifier("a.b.c"),
                         "553f764f7b436175c0387e22b4a19213")

        # … but it also supports a custom override mechanism which would
        # definitely fail with the default implementation:
        class custom_id_class(object):
            def get_custom_haystack_id(self):
                return "CUSTOM"

        self.assertEqual(get_identifier(custom_id_class()), "CUSTOM")
 def test_haystack_identifier_method(self):
     get_identifier = _lookup_identifier_method()
     self.assertEqual(get_identifier('a.b.c'), 'a.b.c')
示例#4
0
 def test_haystack_identifier_method(self):
     get_identifier = _lookup_identifier_method()
     self.assertEqual(get_identifier('a.b.c'), 'a.b.c')