Switch to unified view

a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
...
...
150
        assert M.ProjectRole.query.find(dict(user_id=user._id, project_id=p._id)).count() <= 1
150
        assert M.ProjectRole.query.find(dict(user_id=user._id, project_id=p._id)).count() <= 1
151
151
152
    def test_default_lookup(self):
152
    def test_default_lookup(self):
153
        # Make sure that default _lookup() throws 404
153
        # Make sure that default _lookup() throws 404
154
        self.app.get('/auth/foobar', status=404)
154
        self.app.get('/auth/foobar', status=404)
155
156
157
class TestUserPermissions(TestController):
158
    allow = dict(allow_read=True, allow_write=True, allow_create=True)
159
    read = dict(allow_read=True, allow_write=False, allow_create=False)
160
    disallow = dict(allow_read=False, allow_write=False, allow_create=False)
161
162
    def test_permissions_page(self):
163
        response = self.app.get('/u/test-admin/profile/permissions', params={'repo_path': 'git/test/src'})
164
165
    def test_unknown_project(self):
166
        r = self._check_repo('/git/foo/bar', status=404)
167
168
    def test_unknown_app(self):
169
        r = self._check_repo('/git/test/bar')
170
        assert r == self.disallow, r
171
172
    def test_repo_write(self):
173
        r = self._check_repo('/git/test/src.git')
174
        assert r == self.allow, r
175
        r = self._check_repo('/git/test/src')
176
        assert r == self.allow, r
177
178
    def test_subdir(self):
179
        r = self._check_repo('/git/test/src.git/foo')
180
        assert r == self.allow, r
181
        r = self._check_repo('/git/test/src/foo')
182
        assert r == self.allow, r
183
184
    def test_neighborhood(self):
185
        r = self._check_repo('/git/test.p/src.git')
186
        assert r == self.allow, r
187
188
    def test_repo_read(self):
189
        r = self._check_repo(
190
            '/git/test.p/src.git',
191
            username='test-user')
192
        assert r == self.read, r
193
194
    def test_unknown_user(self):
195
        r = self._check_repo(
196
            '/git/test.p/src.git',
197
            username='test-usera',
198
            status=404)
199
200
    def _check_repo(self, path, username='test-admin', **kw):
201
        url = '/auth/repo_permissions'
202
        r = self.app.get(url, params=dict(
203
                repo_path=path,
204
                username=username), **kw)
205
        try:
206
            return r.json
207
        except:
208
            return r