You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2018/06/11 20:54:37 UTC
[1/6] allura git commit: [#8202] Personal Dashboard - Fix issue in
merge_request.html
Repository: allura
Updated Branches:
refs/heads/master 9215f5b6f -> 2114a6cda
[#8202] Personal Dashboard - Fix issue in merge_request.html
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/6ed41089
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/6ed41089
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/6ed41089
Branch: refs/heads/master
Commit: 6ed41089aa04136e332e562c9e16c48afb14d5d5
Parents: 3de45d2
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Tue Jun 12 00:07:55 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jun 11 16:44:41 2018 -0400
----------------------------------------------------------------------
.../ext/personal_dashboard/templates/sections/merge_requests.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/6ed41089/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html b/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
index 0076d7b..10c2dcb 100644
--- a/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
+++ b/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
@@ -24,6 +24,6 @@
{% block actions %}{% endblock %}
-{% block section_class %}merge requests{% endblock %}
+{% block section_class %}merge_requests{% endblock %}
{% block content %}{% endblock %}
[4/6] allura git commit: [#8202] Personal Dashboard - Checks whether
the request.referer is null
Posted by br...@apache.org.
[#8202] Personal Dashboard - Checks whether the request.referer is null
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/030a6881
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/030a6881
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/030a6881
Branch: refs/heads/master
Commit: 030a6881fcce2aa604bd57cad0770327ee166492
Parents: 26bae56
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Tue Jun 5 12:06:24 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jun 11 16:44:41 2018 -0400
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/030a6881/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 2c5ff1a..053482e 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -118,7 +118,7 @@ class AuthController(BaseController):
elif orig_request:
return_to = orig_request.url
else:
- if request.referer.split('/')[-1] == 'neighborhood':
+ if request.referer is not None and request.referer.split('/')[-1] == 'neighborhood':
return_to = '/'
else:
return_to = request.referer
[3/6] allura git commit: [#8202] Personal Dashboard - Creating basics
of Dashboard (Creating file structure,
defining routes and loading sections to main UI)
Posted by br...@apache.org.
[#8202] Personal Dashboard - Creating basics of Dashboard (Creating file structure, defining routes and loading sections to main UI)
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/26bae561
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/26bae561
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/26bae561
Branch: refs/heads/master
Commit: 26bae5618c4d311f21c178dd9e2397da13d765bd
Parents: 9215f5b
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Wed May 30 19:09:29 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jun 11 16:44:41 2018 -0400
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 5 +-
Allura/allura/controllers/root.py | 13 +-
.../allura/ext/personal_dashboard/__init__.py | 18 +++
.../ext/personal_dashboard/dashboard_main.py | 137 +++++++++++++++++++
.../personal_dashboard/templates/__init__.py | 16 +++
.../templates/dashboard_index.html | 49 +++++++
.../templates/dashboard_section_base.html | 28 ++++
.../templates/sections/followers.html | 29 ++++
.../templates/sections/merge_requests.html | 29 ++++
.../templates/sections/projects.html | 29 ++++
.../templates/sections/tickets.html | 29 ++++
.../templates/jinja_master/theme_macros.html | 2 +-
Allura/setup.py | 6 +
13 files changed, 386 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 537d545..2c5ff1a 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -118,7 +118,10 @@ class AuthController(BaseController):
elif orig_request:
return_to = orig_request.url
else:
- return_to = request.referer
+ if request.referer.split('/')[-1] == 'neighborhood':
+ return_to = '/'
+ else:
+ return_to = request.referer
c.form = F.login_form
return dict(return_to=return_to)
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/controllers/root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/root.py b/Allura/allura/controllers/root.py
index 25bbf89..86c628b 100644
--- a/Allura/allura/controllers/root.py
+++ b/Allura/allura/controllers/root.py
@@ -20,7 +20,7 @@
"""Main Controller"""
import logging
-from tg import expose, request, config, session
+from tg import expose, request, config, session, redirect
from tg.decorators import with_trailing_slash
from tg.flash import TGFlash
from pylons import tmpl_context as c
@@ -33,6 +33,7 @@ from allura.lib import plugin
from allura.controllers.error import ErrorController
from allura import model as M
from allura.lib.widgets import project_list as plw
+from allura.ext.personal_dashboard.dashboard_main import DashboardController
from .auth import AuthController
from .trovecategories import TroveCategoryController
from .search import SearchController, ProjectBrowseController
@@ -73,6 +74,7 @@ class RootController(WsgiDispatchController):
search = SearchController()
rest = RestController()
categories = TroveCategoryController()
+ dashboard = DashboardController()
def __init__(self):
n_url_prefix = '/%s/' % request.path.split('/')[1]
@@ -107,10 +109,17 @@ class RootController(WsgiDispatchController):
def _cleanup_request(self):
pass
- @expose('jinja:allura:templates/neighborhood_list.html')
+ @expose()
@with_trailing_slash
def index(self, **kw):
"""Handle the front-page."""
+ if not c.user.is_anonymous():
+ redirect('/dashboard')
+ else:
+ redirect('/neighborhood')
+
+ @expose('jinja:allura:templates/neighborhood_list.html')
+ def neighborhood(self, **kw):
neighborhoods = M.Neighborhood.query.find().sort('name')
categories = M.ProjectCategory.query.find(
{'parent_id': None}).sort('name').all()
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/__init__.py b/Allura/allura/ext/personal_dashboard/__init__.py
new file mode 100644
index 0000000..2050d54
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/__init__.py
@@ -0,0 +1,18 @@
+# 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 .dashboard_main import DashboardSectionBase
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/dashboard_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/dashboard_main.py b/Allura/allura/ext/personal_dashboard/dashboard_main.py
new file mode 100644
index 0000000..5622c1a
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/dashboard_main.py
@@ -0,0 +1,137 @@
+# 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.
+
+import logging
+import re
+
+import tg
+from jinja2 import Markup
+from paste.deploy.converters import asbool
+from pylons import app_globals as g
+from pylons import request
+from pylons import tmpl_context as c
+from tg import expose, redirect
+
+from allura.controllers import BaseController
+from allura.controllers.feed import FeedController
+from allura.lib import helpers as h
+from allura.lib.plugin import AuthenticationProvider
+
+log = logging.getLogger(__name__)
+
+
+class DashboardController(BaseController, FeedController):
+
+ @expose('jinja:allura.ext.personal_dashboard:templates/dashboard_index.html')
+ def index(self, **kw):
+ if not c.user.is_anonymous():
+ user = c.user
+ sections = {}
+ for ep in h.iter_entry_points('allura.personal_dashboard.sections'):
+ sections[ep.name] = ep.load()
+ section_ordering = tg.config.get('personal_dashboard_sections.order', '')
+ ordered_sections = []
+ for section in re.split(r'\s*,\s*', section_ordering):
+ if section in sections:
+ ordered_sections.append(sections.pop(section))
+ dashboard_sections = ordered_sections + sections.values()
+ sections = [section(user)
+ for section in dashboard_sections]
+ return dict(user=user, sections=sections, title="Personal Dashboard")
+ else:
+ redirect('/neighborhood')
+
+
+class DashboardSectionBase(object):
+ """
+ This is the base class for sections on the Dashboard tool.
+
+ .. py:attribute:: template
+
+ A resource string pointing to the template for this section. E.g.::
+
+ template = "allura.ext.personal_dashboard:templates/projects.html"
+
+ Sections must be pointed to by an entry-point in the group
+ ``[allura.personal_dashboard.sections]``.
+ """
+ template = ''
+
+ def __init__(self, user):
+ """
+ Creates a section for the given :param:`user`. Stores the values as attributes of
+ the same name.
+ """
+ self.user = user
+
+ def check_display(self):
+ """
+ Should return True if the section should be displayed.
+ """
+ return True
+
+ def prepare_context(self, context):
+ """
+ Should be overridden to add any values to the template context prior
+ to display.
+ """
+ return context
+
+ def display(self, *a, **kw):
+ """
+ Renders the section using the context from :meth:`prepare_context`
+ and the :attr:`template`, if :meth:`check_display` returns True.
+
+ If overridden or this base class is not used, this method should
+ return either plain text (which will be escaped) or a `jinja2.Markup`
+ instance.
+ """
+ if not self.check_display():
+ return ''
+ try:
+ tmpl = g.jinja2_env.get_template(self.template)
+ context = self.prepare_context({
+ 'h': h,
+ 'c': c,
+ 'g': g,
+ 'user': self.user,
+ 'config': tg.config,
+ 'auth': AuthenticationProvider.get(request),
+ })
+ return Markup(tmpl.render(context))
+ except Exception as e:
+ log.exception('Error rendering profile section %s: %s', type(self).__name__, e)
+ if asbool(tg.config.get('debug')):
+ raise
+ else:
+ return ''
+
+
+class ProjectsSection(DashboardSectionBase):
+ template = 'allura.ext.personal_dashboard:templates/sections/projects.html'
+
+
+class TicketsSection(DashboardSectionBase):
+ template = 'allura.ext.personal_dashboard:templates/sections/tickets.html'
+
+
+class MergeRequestsSection(DashboardSectionBase):
+ template = 'allura.ext.personal_dashboard:templates/sections/merge_requests.html'
+
+
+class FollowersSection(DashboardSectionBase):
+ template = 'allura.ext.personal_dashboard:templates/sections/followers.html'
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/templates/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/__init__.py b/Allura/allura/ext/personal_dashboard/templates/__init__.py
new file mode 100644
index 0000000..144e298
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/templates/__init__.py
@@ -0,0 +1,16 @@
+# 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.
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/templates/dashboard_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/dashboard_index.html b/Allura/allura/ext/personal_dashboard/templates/dashboard_index.html
new file mode 100644
index 0000000..b08242e
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/templates/dashboard_index.html
@@ -0,0 +1,49 @@
+{#-
+ 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.
+-#}
+{% set hide_left_bar = True %}
+{% extends g.theme.master %}
+
+{% block title %}{{ user.display_name }} / Dashboard{% endblock %}
+
+{% block header %}{{ user.display_name|default(user.username) }}{% endblock %}
+
+{% block head %}
+ <link rel="alternate" type="application/rss+xml" title="RSS" href="feed.rss">
+ <link rel="alternate" type="application/atom+xml" title="Atom" href="feed.atom">
+{% endblock %}
+
+{% block actions %}
+ <a href="{{c.app.url}}feed.rss" title="Follow"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}"></b></a>
+{% endblock %}
+
+{% block nav_menu %}
+ <img src='{{ user.icon_url() }}' alt="{{ user.display_name }}"
+ title="{{ user.display_name }}" class="emboss x48 project_icon">
+ <h1 class="project_title">
+ {{ user.display_name }} / Dashboard
+ </h1>
+{% endblock %}
+
+{% block top_nav %}{# disabled #}{% endblock %}
+
+{% block content_base %}
+ {% for section in sections %}
+ {{ section.display() }}
+ {% endfor %}
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/templates/dashboard_section_base.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/dashboard_section_base.html b/Allura/allura/ext/personal_dashboard/templates/dashboard_section_base.html
new file mode 100644
index 0000000..7e15dad
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/templates/dashboard_section_base.html
@@ -0,0 +1,28 @@
+{#-
+ 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.
+-#}
+<div class="profile-section {% block section_class %}{% endblock %}">
+ <h3>
+ {% block title %}{% endblock %}
+ <span class="actions">{% block actions %}{% endblock %}</span>
+ </h3>
+
+ <div class="section-body">
+ {% block content %}{% endblock %}
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/templates/sections/followers.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/sections/followers.html b/Allura/allura/ext/personal_dashboard/templates/sections/followers.html
new file mode 100644
index 0000000..8c14fca
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/templates/sections/followers.html
@@ -0,0 +1,29 @@
+{#-
+ 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.
+-#}
+{% extends "allura.ext.personal_dashboard:templates/dashboard_section_base.html" %}
+
+{% block title %}
+ Followers
+{% endblock %}
+
+{% block actions %}{% endblock %}
+
+{% block section_class %}followers{% endblock %}
+
+{% block content %}{% endblock %}
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html b/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
new file mode 100644
index 0000000..0076d7b
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/templates/sections/merge_requests.html
@@ -0,0 +1,29 @@
+{#-
+ 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.
+-#}
+{% extends "allura.ext.personal_dashboard:templates/dashboard_section_base.html" %}
+
+{% block title %}
+ Merge Requests
+{% endblock %}
+
+{% block actions %}{% endblock %}
+
+{% block section_class %}merge requests{% endblock %}
+
+{% block content %}{% endblock %}
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/templates/sections/projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/sections/projects.html b/Allura/allura/ext/personal_dashboard/templates/sections/projects.html
new file mode 100644
index 0000000..fa24167
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/templates/sections/projects.html
@@ -0,0 +1,29 @@
+{#-
+ 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.
+-#}
+{% extends "allura.ext.personal_dashboard:templates/dashboard_section_base.html" %}
+
+{% block title %}
+ Projects
+{% endblock %}
+
+{% block actions %}{% endblock %}
+
+{% block section_class %}projects{% endblock %}
+
+{% block content %}{% endblock %}
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/ext/personal_dashboard/templates/sections/tickets.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/sections/tickets.html b/Allura/allura/ext/personal_dashboard/templates/sections/tickets.html
new file mode 100644
index 0000000..530f60e
--- /dev/null
+++ b/Allura/allura/ext/personal_dashboard/templates/sections/tickets.html
@@ -0,0 +1,29 @@
+{#-
+ 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.
+-#}
+{% extends "allura.ext.personal_dashboard:templates/dashboard_section_base.html" %}
+
+{% block title %}
+ Tickets
+{% endblock %}
+
+{% block actions %}{% endblock %}
+
+{% block section_class %}tickets{% endblock %}
+
+{% block content %}{% endblock %}
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/allura/templates/jinja_master/theme_macros.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/theme_macros.html b/Allura/allura/templates/jinja_master/theme_macros.html
index 70a6d68..bb1f381 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -46,7 +46,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
{% if h.asbool(config.get('auth.allow_user_registration', True)) %}
<a class="link-right" href="/auth/create_account">Register</a>
{% endif %}
- <a class="link-right" href="{{login_url}}?return_to={{ h.urlquote(request.path_qs) }}">Log In</a>
+ <a class="link-right" href="{{login_url}}">Log In</a>
{% endif %}
</nav>
</div>
http://git-wip-us.apache.org/repos/asf/allura/blob/26bae561/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index 30bca7d..8fbb87f 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -121,6 +121,12 @@ setup(
skills = allura.ext.user_profile.user_main:SkillsSection
tools = allura.ext.user_profile.user_main:ToolsSection
social = allura.ext.user_profile.user_main:SocialSection
+
+ [allura.personal_dashboard.sections]
+ projects = allura.ext.personal_dashboard.dashboard_main:ProjectsSection
+ tickets = allura.ext.personal_dashboard.dashboard_main:TicketsSection
+ merge_requests = allura.ext.personal_dashboard.dashboard_main:MergeRequestsSection
+ followers = allura.ext.personal_dashboard.dashboard_main:FollowersSection
[allura.webhooks]
repo-push = allura.webhooks:RepoPushWebhookSender
[2/6] allura git commit: [#8202] Personal Dashboard - Fix the test
cases to follow redirects
Posted by br...@apache.org.
[#8202] Personal Dashboard - Fix the test cases to follow redirects
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/3de45d2d
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/3de45d2d
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/3de45d2d
Branch: refs/heads/master
Commit: 3de45d2d20f5b393b13ef11812554d8757e02848
Parents: c269f4a
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Sat Jun 9 11:56:13 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jun 11 16:44:41 2018 -0400
----------------------------------------------------------------------
Allura/allura/tests/functional/test_auth.py | 86 ++++++++++----------
Allura/allura/tests/functional/test_nav.py | 16 ++--
.../forgechat/tests/functional/test_root.py | 2 +-
.../forgetracker/tests/functional/test_root.py | 8 +-
.../forgeuserstats/tests/test_stats.py | 2 +-
5 files changed, 58 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/3de45d2d/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index 0d0cd36..4acce7d 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -77,8 +77,8 @@ class TestAuth(TestController):
r = self.app.post('/auth/do_login', params=dict(
username='test-user', password='foo',
_session_id=self.app.cookies['_session_id']),
- antispam=True)
- assert_equal(r.headers['Location'], 'http://localhost/')
+ antispam=True).follow()
+ assert_equal(r.headers['Location'], 'http://localhost/dashboard')
with assert_raises(ValueError) as ex:
r = self.app.post('/auth/do_login', antispam=True, params=dict(
@@ -127,13 +127,13 @@ class TestAuth(TestController):
username='test-user', password='foo',
_session_id=self.app.cookies['_session_id']),
extra_environ={'REMOTE_ADDR': '127.0.0.1'},
- antispam=True).follow()
+ antispam=True).follow().follow()
logged_in_session = r.session['_id']
links = r.html.find(*nav_pattern).findAll('a')
assert_equal(links[-1].string, "Log Out")
- r = self.app.get('/auth/logout').follow()
+ r = self.app.get('/auth/logout').follow().follow()
logged_out_session = r.session['_id']
assert logged_in_session is not logged_out_session
links = r.html.find(*nav_pattern).findAll('a')
@@ -145,7 +145,7 @@ class TestAuth(TestController):
assert_equal(user.last_access['login_ip'], None)
assert_equal(user.last_access['login_ua'], None)
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
self.app.post('/auth/do_login',
headers={'User-Agent': 'browser'},
extra_environ={'REMOTE_ADDR': '127.0.0.1'},
@@ -164,7 +164,7 @@ class TestAuth(TestController):
def test_rememberme(self):
username = M.User.query.get(username='test-user').username
- r = self.app.get('/') # establish session
+ r = self.app.get('/').follow() # establish session
# Login as test-user with remember me checkbox off
r = self.app.post('/auth/do_login', params=dict(
@@ -195,7 +195,7 @@ class TestAuth(TestController):
email_address = 'test_abcd_123@domain.net'
user = M.User.query.get(username='test-admin')
addresses_number = len(user.email_addresses)
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
self.app.post('/auth/preferences/update_emails',
params={
'new_addr.addr': email_address,
@@ -227,7 +227,7 @@ class TestAuth(TestController):
@patch('allura.tasks.mail_tasks.sendsimplemail')
@patch('allura.lib.helpers.gen_message_id')
def test_user_added_claimed_address_by_other_user_confirmed(self, gen_message_id, sendsimplemail):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
email_address = 'test_abcd_123@domain.net'
# test-user claimed & confirmed email address
@@ -285,7 +285,7 @@ class TestAuth(TestController):
user1 = M.User.query.get(username='test-user-1')
addresses_number = len(user1.email_addresses)
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
r = self.app.post('/auth/preferences/update_emails',
params={
'new_addr.addr': email_address,
@@ -309,7 +309,7 @@ class TestAuth(TestController):
@patch('allura.lib.helpers.gen_message_id')
def test_user_cannot_claim_more_than_max_limit(self, gen_message_id, sendsimplemail):
with h.push_config(config, **{'user_prefs.maximum_claimed_emails': '2'}):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
r = self.app.post('/auth/preferences/update_emails',
params={
'new_addr.addr': 'test_abcd_1@domain.net',
@@ -339,7 +339,7 @@ class TestAuth(TestController):
@patch('allura.tasks.mail_tasks.sendsimplemail')
@patch('allura.lib.helpers.gen_message_id')
def test_verification_link_for_confirmed_email(self, gen_message_id, sendsimplemail):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
email_address = 'test_abcd@domain.net'
# test-user claimed email address
@@ -370,7 +370,7 @@ class TestAuth(TestController):
"but it is already claimed by your %s account." % (email_address, user.username) in kwargs['text']
def test_invalidate_verification_link_if_email_was_confirmed(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
email_address = 'test_abcd@domain.net'
# test-user claimed email address
@@ -398,7 +398,7 @@ class TestAuth(TestController):
assert not email.confirmed
def test_verify_addr_correct_session(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
email_address = 'test_abcd@domain.net'
# test-user claimed email address
@@ -481,7 +481,7 @@ class TestAuth(TestController):
user = self._create_password_reset_hash()
session(user).flush(user)
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
change_params['_session_id'] = self.app.cookies['_session_id']
self.app.post('/auth/preferences/update_emails',
extra_environ=dict(username='test-admin'),
@@ -494,7 +494,7 @@ class TestAuth(TestController):
@td.with_user_project('test-admin')
def test_change_password(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
# Get and assert user with password reset token.
user = self._create_password_reset_hash()
old_pass = user.get_pref('password')
@@ -579,7 +579,7 @@ class TestAuth(TestController):
@td.with_user_project('test-admin')
def test_email_prefs_change_requires_password(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
# Claim new email
new_email_params = {
'new_addr.addr': 'test@example.com',
@@ -734,7 +734,7 @@ class TestAuth(TestController):
assert not s, "User still has subscription with Mailbox._id %s" % s_id
def test_format_email(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
self.app.post('/auth/subscriptions/update_subscriptions',
params={'email_format': 'plain', 'subscriptions': '',
'_session_id': self.app.cookies['_session_id']})
@@ -765,7 +765,7 @@ class TestAuth(TestController):
display_name='Test Me',
_session_id=self.app.cookies['_session_id'],
))
- r = r.follow()
+ r = r.follow().follow()
assert 'User "aaa" registered' in unentity(r.body)
r = self.app.post(
'/auth/save_new',
@@ -785,7 +785,7 @@ class TestAuth(TestController):
status=302)
def test_create_account_require_email(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
with h.push_config(config, **{'auth.require_email_addr': 'false'}):
self.app.post(
'/auth/save_new',
@@ -817,7 +817,7 @@ class TestAuth(TestController):
def test_verify_email(self):
with h.push_config(config, **{'auth.require_email_addr': 'true'}):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
r = self.app.post(
'/auth/save_new',
params=dict(
@@ -852,7 +852,7 @@ class TestAuth(TestController):
def test_create_account_disabled_submit_fails(self):
with h.push_config(config, **{'auth.allow_user_registration': 'false'}):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
self.app.post('/auth/save_new',
params=dict(
username='aaa',
@@ -869,7 +869,7 @@ class TestAuth(TestController):
an admin page."""
p_nbhd = M.Neighborhood.query.get(name='Projects')
p = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
self.app.post('/auth/save_new', params=dict(
username='aaa',
pw='12345678',
@@ -911,7 +911,7 @@ class TestAuth(TestController):
assert_equal(r.location, 'http://localhost/auth/?return_to=%2Fp%2Ftest%2Fadmin%2F')
def test_no_open_return_to(self):
- r = self.app.get('/auth/logout').follow()
+ r = self.app.get('/auth/logout').follow().follow()
r = self.app.post('/auth/do_login', params=dict(
username='test-user', password='foo',
return_to='/foo',
@@ -931,18 +931,18 @@ class TestAuth(TestController):
r = self.app.post('/auth/do_login', antispam=True, params=dict(
username='test-user', password='foo',
return_to='http://example.com/foo',
- _session_id=self.app.cookies['_session_id']))
- assert_equal(r.location, 'http://localhost/')
+ _session_id=self.app.cookies['_session_id'])).follow()
+ assert_equal(r.location, 'http://localhost/dashboard')
r = self.app.get('/auth/logout')
r = self.app.post('/auth/do_login', antispam=True, params=dict(
username='test-user', password='foo',
return_to='//example.com/foo',
- _session_id=self.app.cookies['_session_id']))
- assert_equal(r.location, 'http://localhost/')
+ _session_id=self.app.cookies['_session_id'])).follow()
+ assert_equal(r.location, 'http://localhost/dashboard')
def test_no_injected_headers_in_return_to(self):
- r = self.app.get('/auth/logout').follow()
+ r = self.app.get('/auth/logout').follow().follow()
r = self.app.post('/auth/do_login', params=dict(
username='test-user', password='foo',
return_to='/foo\nContent-Length: 777',
@@ -1312,7 +1312,7 @@ class TestPreferences(TestController):
@td.with_user_project('test-admin')
def test_user_message(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
assert not M.User.query.get(username='test-admin').get_pref('disable_user_messages')
self.app.post('/auth/preferences/user_message',
params={'_session_id': self.app.cookies['_session_id'],
@@ -1357,7 +1357,7 @@ class TestPasswordReset(TestController):
{'claimed_by_user_id': user._id}).first()
email.confirmed = False
ThreadLocalORMSession.flush_all()
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
self.app.post('/auth/password_recovery_hash', {'email': email.email,
'_session_id': self.app.cookies['_session_id'],
})
@@ -1372,7 +1372,7 @@ class TestPasswordReset(TestController):
{'claimed_by_user_id': user._id}).first()
user.disabled = True
ThreadLocalORMSession.flush_all()
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
self.app.post('/auth/password_recovery_hash', {'email': email.email,
'_session_id': self.app.cookies['_session_id'],
})
@@ -1382,7 +1382,7 @@ class TestPasswordReset(TestController):
@patch('allura.tasks.mail_tasks.sendsimplemail')
@patch('allura.lib.helpers.gen_message_id')
def test_only_primary_email_reset_allowed(self, gen_message_id, sendmail):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
user = M.User.query.get(username='test-admin')
user.claim_address(self.test_primary_email)
user.set_pref('email_address', self.test_primary_email)
@@ -1403,7 +1403,7 @@ class TestPasswordReset(TestController):
@patch('allura.tasks.mail_tasks.sendsimplemail')
@patch('allura.lib.helpers.gen_message_id')
def test_non_primary_email_reset_allowed(self, gen_message_id, sendmail):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
user = M.User.query.get(username='test-admin')
email1 = M.EmailAddress.find({'claimed_by_user_id': user._id}).first()
user.claim_address(self.test_primary_email)
@@ -1423,7 +1423,7 @@ class TestPasswordReset(TestController):
@patch('allura.tasks.mail_tasks.sendsimplemail')
@patch('allura.lib.helpers.gen_message_id')
def test_password_reset(self, gen_message_id, sendmail):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
user = M.User.query.get(username='test-admin')
email = M.EmailAddress.find({'claimed_by_user_id': user._id}).first()
email.confirmed = True
@@ -1488,7 +1488,7 @@ To reset your password on %s, please visit the following URL:
form[encoded['username']] = 'test-admin'
form[encoded['password']] = new_password
r = form.submit(status=302)
- r = r.follow()
+ r = r.follow().follow()
assert 'Log Out' in r, r
@patch('allura.tasks.mail_tasks.sendsimplemail')
@@ -1499,7 +1499,7 @@ To reset your password on %s, please visit the following URL:
{'claimed_by_user_id': user._id}).first()
email.confirmed = True
ThreadLocalORMSession.flush_all()
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
r = self.app.post('/auth/password_recovery_hash', {'email': email.email,
'_session_id': self.app.cookies['_session_id'],
})
@@ -1548,7 +1548,7 @@ class TestOAuth(TestController):
def test_generate_revoke_access_token(self):
# generate
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
r = self.app.post('/auth/oauth/register',
params={'application_name': 'oautstapp', 'application_description': 'Oauth rulez',
'_session_id': self.app.cookies['_session_id'],
@@ -1856,7 +1856,7 @@ class TestDisableAccount(TestController):
assert form is not None
def test_bad_password(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
r = self.app.post('/auth/disable/do_disable', {'password': 'bad',
'_session_id': self.app.cookies['_session_id'], })
assert_in('Invalid password', r)
@@ -1864,7 +1864,7 @@ class TestDisableAccount(TestController):
assert_equal(user.disabled, False)
def test_disable(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
r = self.app.post('/auth/disable/do_disable', {'password': 'foo',
'_session_id': self.app.cookies['_session_id'], })
assert_equal(r.status_int, 302)
@@ -1893,8 +1893,8 @@ class TestPasswordExpire(TestController):
except exc.HTTPFound as e:
assert_equal(e.location, '/auth/pwd_expired?' + urlencode({'return_to': where}))
- def assert_not_redirects(self):
- self.app.get('/', extra_environ={'username': 'test-user'}, status=200)
+ def assert_not_redirects(self, where='/neighborhood'):
+ self.app.get(where, extra_environ={'username': 'test-user'}, status=200)
def test_disabled(self):
r = self.login()
@@ -1973,8 +1973,8 @@ class TestPasswordExpire(TestController):
assert_not_equal(user.password, old_password)
# Can log in with new password and change isn't required anymore
- r = self.login(pwd='qwerty')
- assert_equal(r.location, 'http://localhost/')
+ r = self.login(pwd='qwerty').follow()
+ assert_equal(r.location, 'http://localhost/dashboard')
assert_not_in('Invalid login', r)
assert_false(self.expired(r))
self.assert_not_redirects()
http://git-wip-us.apache.org/repos/asf/allura/blob/3de45d2d/Allura/allura/tests/functional/test_nav.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_nav.py b/Allura/allura/tests/functional/test_nav.py
index f6faba3..0945d09 100644
--- a/Allura/allura/tests/functional/test_nav.py
+++ b/Allura/allura/tests/functional/test_nav.py
@@ -55,7 +55,7 @@ class TestNavigation(TestController):
def test_global_nav_links_present(self):
with h.push_config(config, **self._set_config()):
- response = self.app.get('/')
+ response = self.app.get('/').follow()
nav_left = response.html.find(*self.global_nav_pattern)
assert len(nav_left.findAll('a')) == 1
assert nav_left.a.get('href') == self.nav_data['url']
@@ -64,13 +64,13 @@ class TestNavigation(TestController):
@mock.patch.object(g, 'global_nav', return_value=[])
def test_global_nav_links_absent(self, global_nav):
with h.push_config(config, **self._set_config()):
- response = self.app.get('/')
+ response = self.app.get('/').follow()
nav_left = response.html.find(*self.global_nav_pattern)
assert len(nav_left.findAll('a')) == 0
def test_logo_absent_if_not_image_path(self):
with h.push_config(config, **self._set_config()):
- response = self.app.get('/')
+ response = self.app.get('/').follow()
nav_logo = response.html.find(*self.logo_pattern)
assert len(nav_logo.findAll('a')) == 0
@@ -78,7 +78,7 @@ class TestNavigation(TestController):
self.logo_data = {
"link": "/", "path": "user.png"}
with h.push_config(config, **self._set_config()):
- response = self.app.get('/')
+ response = self.app.get('/').follow()
nav_logo = response.html.find(*self.logo_pattern)
assert len(nav_logo.findAll('a')) == 1
assert self.logo_data['path'] in nav_logo.a.img.get('src')
@@ -87,7 +87,7 @@ class TestNavigation(TestController):
self.logo_data = {
"link": "", "path": "user.png"}
with h.push_config(config, **self._set_config()):
- response = self.app.get('/')
+ response = self.app.get('/').follow()
nav_logo = response.html.find(*self.logo_pattern)
assert len(nav_logo.findAll('a')) == 1
assert nav_logo.a.get('href') == '/'
@@ -97,7 +97,7 @@ class TestNavigation(TestController):
"link": "", "path": "user.png",
"width": 20, "height": 20}
with h.push_config(config, **self._set_config()):
- response = self.app.get('/')
+ response = self.app.get('/').follow()
nav_logo = response.html.find(*self.logo_pattern)
width = self.width % self.logo_data["width"]
height = self.height % self.logo_data["height"]
@@ -109,7 +109,7 @@ class TestNavigation(TestController):
"link": "", "path": "user.png",
"height": 20}
with h.push_config(config, **self._set_config()):
- response = self.app.get('/')
+ response = self.app.get('/').follow()
nav_logo = response.html.find(*self.logo_pattern)
height = self.height % self.logo_data["height"]
assert nav_logo.find(
@@ -120,7 +120,7 @@ class TestNavigation(TestController):
"link": "/", "path": "user.png",
"width": 20}
with h.push_config(config, **self._set_config()):
- response = self.app.get('/')
+ response = self.app.get('/').follow()
nav_logo = response.html.find(*self.logo_pattern)
width = self.width % self.logo_data["width"]
assert nav_logo.find(
http://git-wip-us.apache.org/repos/asf/allura/blob/3de45d2d/ForgeChat/forgechat/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeChat/forgechat/tests/functional/test_root.py b/ForgeChat/forgechat/tests/functional/test_root.py
index 49b824d..96426c1 100644
--- a/ForgeChat/forgechat/tests/functional/test_root.py
+++ b/ForgeChat/forgechat/tests/functional/test_root.py
@@ -35,7 +35,7 @@ class TestRootController(TestController):
@with_chat
def test_admin_configure(self):
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
data = {'channel': 'test channel',
'_session_id': self.app.cookies['_session_id']}
ch = CM.ChatChannel.query.get()
http://git-wip-us.apache.org/repos/asf/allura/blob/3de45d2d/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index db51573..d9b349a 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -2172,15 +2172,17 @@ class TestFunctionalController(TrackerTestController):
def test_move_ticket_bad_data(self):
self.new_ticket(summary='test')
- r = self.app.post('/p/test/bugs/1/move').follow() # empty POST
+ r = self.app.post('/p/test/bugs/1/move', extra_environ={'HTTP_REFERER': '/p/test/bugs/1/'}).follow() # empty POST
assert 'Select valid tracker' in r, r
r = self.app.post('/p/test/bugs/1/move',
- params={'tracker': 'invalid tracker id'}).follow()
+ params={'tracker': 'invalid tracker id'},
+ extra_environ={'HTTP_REFERER': '/p/test/bugs/1/'}).follow()
assert 'Select valid tracker' in r, r
p = M.Project.query.get(shortname='test')
tracker = p.app_instance('bugs')
r = self.app.post('/p/test/bugs/1/move',
- params={'tracker': str(tracker.config._id)}).follow()
+ params={'tracker': str(tracker.config._id)},
+ extra_environ={'HTTP_REFERER': '/p/test/bugs/1/'}).follow()
assert 'Ticket already in a selected tracker' in r, r
def test_move_ticket_access(self):
http://git-wip-us.apache.org/repos/asf/allura/blob/3de45d2d/ForgeUserStats/forgeuserstats/tests/test_stats.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/tests/test_stats.py b/ForgeUserStats/forgeuserstats/tests/test_stats.py
index 173f9b9..fda1bc7 100644
--- a/ForgeUserStats/forgeuserstats/tests/test_stats.py
+++ b/ForgeUserStats/forgeuserstats/tests/test_stats.py
@@ -39,7 +39,7 @@ class TestStats(TestController):
def test_login(self):
user = User.by_username('test-user')
init_logins = user.stats.tot_logins_count
- self.app.get('/') # establish session
+ self.app.get('/').follow() # establish session
self.app.post('/auth/do_login', antispam=True, params=dict(
username=user.username, password='foo',
_session_id=self.app.cookies['_session_id'],
[5/6] allura git commit: [#8202] Personal Dashboard - Improvements in
Root tests. Root tests are successfully passed
Posted by br...@apache.org.
[#8202] Personal Dashboard - Improvements in Root tests. Root tests are successfully passed
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c269f4a1
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c269f4a1
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c269f4a1
Branch: refs/heads/master
Commit: c269f4a1f0c7243b4dd02d8c116d1aa48d31f7cf
Parents: 030a688
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Wed Jun 6 22:13:37 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jun 11 16:44:41 2018 -0400
----------------------------------------------------------------------
Allura/allura/controllers/basetest_project_root.py | 2 +-
Allura/allura/controllers/root.py | 2 ++
Allura/allura/tests/functional/test_root.py | 9 ++++++++-
3 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/c269f4a1/Allura/allura/controllers/basetest_project_root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/basetest_project_root.py b/Allura/allura/controllers/basetest_project_root.py
index f655437..b80d94d 100644
--- a/Allura/allura/controllers/basetest_project_root.py
+++ b/Allura/allura/controllers/basetest_project_root.py
@@ -68,7 +68,7 @@ class BasetestProjectRootController(WsgiDispatchController, ProjectController):
proxy_root = RootController()
self.dispatch = DispatchTest()
self.security = SecurityTests()
- for attr in ('index', 'browse', 'auth', 'nf', 'error', 'categories'):
+ for attr in ('index', 'browse', 'auth', 'nf', 'error', 'categories', 'neighborhood', 'dashboard'):
setattr(self, attr, getattr(proxy_root, attr))
self.gsearch = proxy_root.search
self.rest = RestController()
http://git-wip-us.apache.org/repos/asf/allura/blob/c269f4a1/Allura/allura/controllers/root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/root.py b/Allura/allura/controllers/root.py
index 86c628b..76987e9 100644
--- a/Allura/allura/controllers/root.py
+++ b/Allura/allura/controllers/root.py
@@ -66,6 +66,8 @@ class RootController(WsgiDispatchController):
Keep in mind that WSGI applications shouldn't be mounted directly: They
must be wrapped around with :class:`tg.controllers.WSGIAppController`.
+ When testing the root, BasetestProjectRootController should be considered as the root controller
+
"""
auth = AuthController()
http://git-wip-us.apache.org/repos/asf/allura/blob/c269f4a1/Allura/allura/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_root.py b/Allura/allura/tests/functional/test_root.py
index db9eae8..be81292 100644
--- a/Allura/allura/tests/functional/test_root.py
+++ b/Allura/allura/tests/functional/test_root.py
@@ -52,7 +52,14 @@ class TestRootController(TestController):
n_adobe.register_project('adobe-2', u_admin)
def test_index(self):
+ response = self.app.get('/', extra_environ=dict(username='*anonymous'))
+ assert_equal(response.location, 'http://localhost/neighborhood')
+
response = self.app.get('/')
+ assert_equal(response.location, 'http://localhost/dashboard')
+
+ def test_neighborhood(self):
+ response = self.app.get('/neighborhood')
assert_equal(response.html.find('h2', {'class': 'dark title'}).contents[
0].strip(), 'All Neighborhoods')
nbhds = response.html.findAll('div', {'class': 'nbhd_name'})
@@ -67,7 +74,7 @@ class TestRootController(TestController):
M.ProjectCategory(name='test-xss', label='<script>alert(1)</script>')
ThreadLocalORMSession.flush_all()
- response = self.app.get('/')
+ response = self.app.get('/neighborhood')
# inject it into the sidebar data
content = str(response.html.find('div', {'id': 'content_base'}))
assert '<script>' not in content
[6/6] allura git commit: [#8205] Personal Dashboard - Test dashboard
basics
Posted by br...@apache.org.
[#8205] Personal Dashboard - Test dashboard basics
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2114a6cd
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2114a6cd
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2114a6cd
Branch: refs/heads/master
Commit: 2114a6cda790ab982aca9db92d908fadfef76208
Parents: 6ed4108
Author: deshanigtk <de...@cse.mrt.ac.lk>
Authored: Tue Jun 12 01:07:30 2018 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jun 11 16:54:25 2018 -0400
----------------------------------------------------------------------
.../tests/functional/test_personal_dashboard.py | 32 ++++++++++++++++++++
1 file changed, 32 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2114a6cd/Allura/allura/tests/functional/test_personal_dashboard.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_personal_dashboard.py b/Allura/allura/tests/functional/test_personal_dashboard.py
new file mode 100644
index 0000000..9a5169b
--- /dev/null
+++ b/Allura/allura/tests/functional/test_personal_dashboard.py
@@ -0,0 +1,32 @@
+# 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 nose.tools import assert_equal, assert_in
+
+from allura.tests import TestController
+
+
+class TestPersonalDashboard(TestController):
+
+ def test_profile(self):
+ r = self.app.get('/dashboard')
+ assert_equal('Test Admin / Dashboard', r.html.find('h1', 'project_title').text)
+ sections = set([c for s in r.html.findAll(None, 'profile-section') for c in s['class'].split()])
+ assert_in('tickets', sections)
+ assert_in('projects', sections)
+ assert_in('merge_requests', sections)
+ assert_in('followers', sections)