blob: e5a9aefc1c9e1a8483adeaadf5ee44925347ffb3 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from formencode.variabledecode import variable_encode
from allura.model import Project, User
from allura.tests import decorators as td
from allura.tests import TestController
class TestUserProfile(TestController):
@td.with_user_project('test-admin')
def test_profile(self):
response = self.app.get('/u/test-admin/profile/')
assert '<h2 class="dark title">Test Admin' in response
assert 'OpenIDs' in response
def test_wrong_profile(self):
response = self.app.get('/u/no-such-user/profile/', status=404)
@td.with_user_project('test-admin')
@td.with_user_project('test-user')
def test_seclusion(self):
response = self.app.get('/u/test-admin/profile/')
assert 'Email Addresses' in response
self.app.get('/u/test-user', extra_environ=dict(
username='test-user'))
response = self.app.get('/u/test-user/profile/')
assert 'Email Addresses' not in response
@td.with_user_project('test-user')
def test_missing_user(self):
User.query.remove(dict(username='test-user'))
p = Project.query.get(shortname='u/test-user')
assert p is not None and p.is_user_project
response = self.app.get('/u/test-user/profile/', status=404)
assert 'Email Addresses' not in response
@td.with_user_project('test-admin')
@td.with_wiki
def test_feed(self):
for ext in ['', '.rss', '.atom']:
r = self.app.get('/u/test-admin/profile/feed%s' % ext, status=200)
assert 'Recent posts by Test Admin' in r
assert 'Home modified by Test Admin' in r