You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/02/21 23:21:58 UTC
[10/10] git commit: [#7097] Bug fixes and test fixes
[#7097] Bug fixes and test fixes
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fc1c466a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fc1c466a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fc1c466a
Branch: refs/heads/master
Commit: fc1c466abc8513020907094b68046f863d999ccc
Parents: 881ddc1
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Fri Feb 21 22:21:07 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Feb 21 22:21:07 2014 +0000
----------------------------------------------------------------------
.../user_profile/templates/sections/tools.html | 2 +-
Allura/allura/model/project.py | 2 +-
.../tests/functional/test_neighborhood.py | 4 ++--
.../tests/functional/test_user_profile.py | 24 ++++----------------
4 files changed, 8 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fc1c466a/Allura/allura/ext/user_profile/templates/sections/tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/tools.html b/Allura/allura/ext/user_profile/templates/sections/tools.html
index d6629fd..da0db03 100644
--- a/Allura/allura/ext/user_profile/templates/sections/tools.html
+++ b/Allura/allura/ext/user_profile/templates/sections/tools.html
@@ -24,7 +24,7 @@
{% block actions %}
{% if user == c.user %}
- <a href="{{c.project.url()}}/admin/tools">Add Tools</a>
+ <a href="{{c.project.url()}}admin/tools">Add Tools</a>
{% endif %}
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fc1c466a/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 25d0d9a..452652c 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -367,7 +367,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
@property
def is_user_project(self):
- return self.shortname.startswith('u/')
+ return self.is_root and self.shortname.startswith('u/')
@LazyProperty
def user_project_of(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fc1c466a/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 21b8e37..e66445a 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -900,10 +900,10 @@ class TestNeighborhood(TestController):
assert 'macro' in r
@td.with_user_project('test-user')
- def test_profile_topnav_menu(self):
+ def test_profile_tools(self):
r = self.app.get('/u/test-user/',
extra_environ=dict(username='test-user')).follow()
- assert r.html.find('div', id='top_nav').find(
+ assert r.html.find('div', 'profile-section tools').find(
'a', href='/u/test-user/profile/'), r.html
def test_user_project_creates_on_demand(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fc1c466a/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index a09bf83..3d1270a 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -28,29 +28,19 @@ 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
+ r = self.app.get('/u/test-admin/profile/')
+ assert_equal('Test Admin',
+ r.html.find('h1', 'project_title').find('a').text)
def test_wrong_profile(self):
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
@@ -130,13 +120,7 @@ class TestUserProfile(TestController):
'user@example.com')
r = self.app.get('/u/test-user/profile',
status=200)
- assert '<a href="send_message">Send me a message</a>' in r
-
- r = self.app.get('/u/test-user/profile',
- extra_environ={'username': '*anonymous'},
- status=200)
-
- assert '<a href="send_message">Send me a message</a>' not in r
+ assert r.html.find('a', dict(href='send_message'))
@td.with_user_project('test-user')
def test_disable_user_messages(self):