Roundup Tracker - Issues

Message5896

Author rouilj
Recipients richard, rouilj, schlatterbeck, stefan
Date 2016-08-28.00:04:34
Message-id <1472342676.87.0.727713075367.issue1408570@psf.upfronthosting.co.za>
In-reply-to
Hi Ralf:

It looks like your change to tests/test_cgi.py broke a couple of tests.

=================================== FAILURES
===================================

___________________ FormTestCase.testCSVExportBadColumnName
____________________

self = <test.test_cgi.FormTestCase testMethod=testCSVExportBadColumnName>

    def testCSVExportBadColumnName(self):

        cl = self._make_client({'@columns': 'falseid,name'}, nodeid=None,

            userid='1')

        cl.classname = 'status'

        output = StringIO.StringIO()

        cl.request = MockNull()

        cl.request.wfile = output

        self.assertRaises(exceptions.SeriousError,

>           actions.ExportCSVAction(cl).handle)

test/test_cgi.py:1155: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ 

self = <roundup.cgi.actions.ExportCSVAction instance at 0x7f1d05f56c20>

    def handle(self):

        ''' Export the specified search query as CSV. '''

        # figure the request

        request = templating.HTMLRequest(self.client)

        filterspec = request.filterspec

        sort = request.sort

        group = request.group

        columns = request.columns

        klass = self.db.getclass(request.classname)

    

        # check if all columns exist on class

        # the exception must be raised before sending header

        props = klass.getprops()

        for cname in columns:

            if cname not in props:

                # use error code 400: Bad Request. Do not use

                # error code 404: Not Found.

                self.client.response_code = 400

                raise exceptions.NotFound(

                    self._('Column "%(column)s" not found in %(class)s')

>                   % {'column': cgi.escape(cname), 'class':
request.classname})

E               NotFound: Column "falseid" not found in status

roundup/cgi/actions.py:1264: NotFound

___________________ FormTestCase.testCSVExportFailPermission
___________________

self = <test.test_cgi.FormTestCase testMethod=testCSVExportFailPermission>

    def testCSVExportFailPermission(self):

        cl = self._make_client({'@columns': 'id,email,password'},
nodeid=None,

            userid='2')

        cl.classname = 'user'

        output = StringIO.StringIO()

        cl.request = MockNull()

        cl.request.wfile = output

        # used to be self.assertRaises(exceptions.Unauthorised,

        # but not acting like the column name is not found

        self.assertRaises(exceptions.SeriousError,

>           actions.ExportCSVAction(cl).handle)

test/test_cgi.py:1167: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ 

self = <roundup.cgi.actions.ExportCSVAction instance at 0x7f1d05c4c050>

    def handle(self):

        ''' Export the specified search query as CSV. '''

        # figure the request

        request = templating.HTMLRequest(self.client)

        filterspec = request.filterspec

        sort = request.sort

        group = request.group

        columns = request.columns

        klass = self.db.getclass(request.classname)

    

        # check if all columns exist on class

        # the exception must be raised before sending header

        props = klass.getprops()

        for cname in columns:

            if cname not in props:

                # use error code 400: Bad Request. Do not use

                # error code 404: Not Found.

                self.client.response_code = 400

                raise exceptions.NotFound(

                    self._('Column "%(column)s" not found in %(class)s')

>                   % {'column': cgi.escape(cname), 'class':
request.classname})

E               NotFound: Column "email" not found in user

roundup/cgi/actions.py:1264: NotFound

I grabbed the from the travis0-ci test run, but

./run_tests.py test/test_cgi.py

looks like it's reporting the same.

It's not obvious to me that the changes in the test harness are the
problem. Can you take a look at it.

-- rouilj
History
Date User Action Args
2016-08-28 00:04:36rouiljsetmessageid: <1472342676.87.0.727713075367.issue1408570@psf.upfronthosting.co.za>
2016-08-28 00:04:36rouiljsetrecipients: + rouilj, richard, schlatterbeck, stefan
2016-08-28 00:04:36rouiljlinkissue1408570 messages
2016-08-28 00:04:35rouiljcreate