diff --git a/pagure/templates/master.html b/pagure/templates/master.html
index d20f9be..25b49c5 100644
--- a/pagure/templates/master.html
+++ b/pagure/templates/master.html
@@ -37,6 +37,16 @@
{% if not nologin %}
{% if g.fas_user %}
diff --git a/pagure/ui/app.py b/pagure/ui/app.py
index 5d85c70..587e054 100644
--- a/pagure/ui/app.py
+++ b/pagure/ui/app.py
@@ -358,6 +358,26 @@ def view_user_requests(username):
)
+@APP.route('/user//issues/')
+@APP.route('/user//issues')
+def view_user_issues(username):
+ """
+ Shows the issues created by the specified user.
+
+ :param username: The username to retrieve the issues for
+ :type username: str
+ """
+ user = pagure.lib.search_user(SESSION, username=username)
+ if not user:
+ flask.abort(404, 'No user `%s` found' % username)
+
+ return flask.render_template(
+ 'user_issues.html',
+ username=username,
+ user=user,
+ )
+
+
@APP.route('/new/', methods=('GET', 'POST'))
@APP.route('/new', methods=('GET', 'POST'))
@login_required
@@ -467,6 +487,7 @@ def user_settings():
form=form,
)
+
@APP.route('/settings/usersettings', methods=['POST'])
@login_required
def update_user_settings():
diff --git a/tests/__init__.py b/tests/__init__.py
index cacf7c0..395d2e3 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -188,6 +188,17 @@ class Modeltests(unittest.TestCase):
# Prevent unit-tests to send email, globally
pagure.APP.config['EMAIL_SEND'] = False
+ pagure.APP.config['TESTING'] = True
+ pagure.APP.config['GIT_FOLDER'] = self.path
+ pagure.APP.config['FORK_FOLDER'] = os.path.join(
+ self.path, 'forks')
+ pagure.APP.config['TICKETS_FOLDER'] = os.path.join(
+ self.path, 'tickets')
+ pagure.APP.config['DOCS_FOLDER'] = os.path.join(
+ self.path, 'docs')
+ pagure.APP.config['REQUESTS_FOLDER'] = os.path.join(
+ self.path, 'requests')
+ self.app = pagure.APP.test_client()
def tearDown(self): # pylint: disable=invalid-name
""" Remove the test.db database if there is one. """
diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py
index 744dc24..3e2d9c6 100644
--- a/tests/test_pagure_flask_ui_app.py
+++ b/tests/test_pagure_flask_ui_app.py
@@ -923,6 +923,55 @@ class PagureFlaskApptests(tests.Modeltests):
self.assertEqual(output.status_code, 302)
+class ViewMyRequestsTests(tests.Modeltests):
+
+ def test_view_my_requests_no_user(self):
+ """Test the endpoint."""
+ output = self.app.get('/user/somenonexistentuser/requests')
+ self.assertEqual(output.status_code, 404)
+
+ def test_view_my_requests(self):
+ """Test the index endpoint. """
+ user = tests.FakeUser(username='jcline')
+ with tests.user_set(pagure.APP, user):
+ output = self.app.get('/user/jcline/requests')
+ self.assertEqual(output.status_code, 200)
+
+
+class ViewMyIssuesTests(tests.Modeltests):
+
+ @classmethod
+ def setUpClass(cls):
+ """ Set up the environnment, ran before every tests. """
+ super(ViewMyIssuesTests, cls).setUpClass()
+ tests.create_projects(cls.session)
+ tests.create_projects_git(
+ os.path.join(cls.path, 'tickets'), bare=True)
+ tests.create_tokens(cls.session)
+ tests.create_tokens_acl(cls.session)
+
+ headers = {'Authorization': 'token aaabbbcccddd'}
+ data = {
+ 'title': 'test issue',
+ 'issue_content': 'This issue needs attention',
+ }
+
+ # Valid request
+ cls.app.post('/api/0/test/new_issue', data=data, headers=headers)
+
+ def test_view_my_issues_no_user(self):
+ """Test the endpoint."""
+ output = self.app.get('/user/somenonexistentuser/issues')
+ self.assertEqual(output.status_code, 404)
+
+ def test_view_my_issues(self):
+ """Test the index endpoint. """
+ user = tests.FakeUser(username='jcline')
+ with tests.user_set(pagure.APP, user):
+ output = self.app.get('/user/jcline/issues')
+ self.assertEqual(output.status_code, 200)
+
+
if __name__ == '__main__':
SUITE = unittest.TestLoader().loadTestsFromTestCase(PagureFlaskApptests)
unittest.TextTestRunner(verbosity=2).run(SUITE)