Example #1
0
    def test_get_allowed_order_by(self):
        r = ReportConfiguration(
            ordering='user.first_name'
        )
        g = r.get_allowed_order_by()
        self.assertEqual([('user.first_name', 'user.first_name')], g)

        r = ReportConfiguration(
            ordering='user.first_name  ;   First Name'
        )
        g = r.get_allowed_order_by()
        self.assertEqual([('user.first_name', 'First Name')], g)

        r = ReportConfiguration(
            ordering='''user.first_name;First Name
            user.last_name;Last Name
            random;extra;items
            single
            '''
        )
        g = r.get_allowed_order_by()
        self.assertEqual([('user.first_name', 'First Name'),
                          ('user.last_name', 'Last Name'),
                          ('random', 'extra;items'),
                          ('single', 'single')], g)