コード例 #1
0
ファイル: tests.py プロジェクト: michaelBenin/geonode
        def assert_rules(rules):
            rank_rules = []
            for model, model_rules in rules:
                rank_rules.extend(search._rank_rules(model, *model_rules))

            sql = search._add_relevance(query, rank_rules)

            for _, model_rules in rules:
                for attr, rank1, rank2 in model_rules:
                    self.assertTrue(('THEN %d ELSE 0' % rank1) in sql)
                    self.assertTrue(('THEN %d ELSE 0' % rank2) in sql)
                    self.assertTrue(attr in sql)
コード例 #2
0
        def assert_rules(rules):
            rank_rules = []
            for model, model_rules in rules:
                rank_rules.extend(search._rank_rules(model, *model_rules))

            sql = search._add_relevance(query, rank_rules)

            for _, model_rules in rules:
                for attr, rank1, rank2 in model_rules:
                    self.assertTrue(('THEN %d ELSE 0' % rank1) in sql)
                    self.assertTrue(('THEN %d ELSE 0' % rank2) in sql)
                    self.assertTrue(attr in sql)