Example #1
0
    def setUp(self):
        self.working_dir = tempfile.mkdtemp()

        # Because uh, QSettings has very nice API so we need this
        QSettings.setDefaultFormat(QSettings.Format.IniFormat)

        # and this line, which include
        QSettings.setPath(
            QSettings.Format.IniFormat,  # this arg
            QSettings.Scope.SystemScope,
            self.working_dir,
        )

        # to have our test settings isolated from the real application.
        # Insert profanity here: ________________

        # now we make our info
        info = PMR()

        self.endpoints = [
            (info.host() + '/pmr2-dashboard',
             TestAdapter(stream=workspace_home)),
            ('http://example.com/dashboard/addworkspace',
             TestAdapter(stream='',
                         headers={
                             'Location': 'http://example.com/w/+/addworkspace',
                         })),
            (
                'http://example.com/w/+/addworkspace',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='',
                    headers={
                        'Location': 'http://example.com/w/1',
                    })),
            (
                'http://example.com/hgrepo',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='{"url": "http://example.com/hgrepo", '
                    '"storage": "git"}', )),
            (
                'http://example.com/w/1',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='{"url": "http://example.com/w/1", '
                    '"storage": "git"}', )),
            ('http://example.com/w/1/request_temporary_password',
             TestAdapter(stream='{"user": "******", "key": "secret"}', )),
            (info.host() + '/search',
             TestAdapter(stream='[{"title": "Test Workspace", '
                         '"target": "http://example.com/w/1"}]', )),
        ]

        # and tool, with the end points.
        self._tool = self.make_tool()
    def setUp(self):
        self.working_dir = tempfile.mkdtemp()

        # Because uh, QSettings has very nice API so we need this
        QSettings.setDefaultFormat(QSettings.Format.IniFormat)

        # and this line, which include
        QSettings.setPath(
            QSettings.Format.IniFormat,  # this arg
            QSettings.Scope.SystemScope,
            self.working_dir,
        )

        # to have our test settings isolated from the real application.
        # Insert profanity here: ________________

        # now we make our info
        info = PMRInfo()

        self.endpoints = [
            (info.host + '/pmr2-dashboard',
                TestAdapter(stream=workspace_home)),

            ('http://example.com/dashboard/addworkspace',
                TestAdapter(
                    stream='',
                    headers={
                        'Location': 'http://example.com/w/+/addworkspace',
                    }
                )
            ),

            ('http://example.com/w/+/addworkspace',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='',
                    headers={
                        'Location': 'http://example.com/w/1',
                    }
                )
            ),

            ('http://example.com/hgrepo',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='{"url": "http://example.com/hgrepo", '
                        '"storage": "mercurial"}',
                )
            ),

            ('http://example.com/w/1',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='{"url": "http://example.com/w/1", '
                        '"storage": "mercurial"}',
                )
            ),

            ('http://example.com/w/1/request_temporary_password',
                TestAdapter(
                    stream='{"user": "******", "key": "secret"}',
                )
            ),

            (info.host + '/search',
                TestAdapter(
                    stream='[{"title": "Test Workspace", '
                           '"target": "http://example.com/w/1"}]',
                )
            ),

        ]

        # and tool, with the end points.
        self._tool = self.make_tool()