allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/4] allura git commit: [#8219] Personal Dashboard - Test Tickets section
Date Sun, 22 Jul 2018 19:45:31 GMT
Repository: allura
Updated Branches:
  refs/heads/master 50d318d1e -> 43c241b96


[#8219] Personal Dashboard - Test Tickets section


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/a7ddd0c0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/a7ddd0c0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/a7ddd0c0

Branch: refs/heads/master
Commit: a7ddd0c0bbcfe89cb14fc5214deff168cbb20477
Parents: 50d318d
Author: deshanigtk <deshani.14@cse.mrt.ac.lk>
Authored: Fri Jul 13 17:32:50 2018 +0530
Committer: deshanigtk <deshani.14@cse.mrt.ac.lk>
Committed: Mon Jul 16 18:58:45 2018 +0530

----------------------------------------------------------------------
 .../tests/functional/test_personal_dashboard.py | 47 ++++++++++++++++++++
 1 file changed, 47 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/a7ddd0c0/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
index 9df4441..46912c1 100644
--- a/Allura/allura/tests/functional/test_personal_dashboard.py
+++ b/Allura/allura/tests/functional/test_personal_dashboard.py
@@ -19,8 +19,13 @@ import mock
 import tg
 from nose.tools import assert_equal, assert_in, assert_not_in
 
+from allura import model as M
 from allura.lib.widgets.user_profile import SectionsUtil
 from allura.tests import TestController
+from allura.tests import decorators as td
+from ming.orm.ormsession import ThreadLocalORMSession
+
+from forgetracker.tests.functional.test_root import TrackerTestController
 
 
 class TestPersonalDashboard(TestController):
@@ -57,3 +62,45 @@ class TestPersonalDashboard(TestController):
                 assert_in('Section c', r.body)
                 assert_in('Section d', r.body)
                 assert_not_in('Section f', r.body)
+
+
+class TestTicketsSection(TestController):
+
+    def _find_new_ticket_form(self, resp):
+        def cond(f):
+            return f.action.endswith('/save_ticket')
+
+        return self.find_form(resp, cond)
+
+    def new_ticket(self, mount_point='/bugs/', extra_environ=None, **kw):
+        extra_environ = extra_environ or {}
+        response = self.app.get(mount_point + 'new/',
+                                extra_environ=extra_environ)
+        form = self._find_new_ticket_form(response)
+        # If this is ProjectUserCombo's select populate it
+        # with all the users in the project. This is a workaround for tests,
+        # in real enviroment this is populated via ajax.
+        p = M.Project.query.get(shortname='test')
+        for f in form.fields:
+            field = form[f] if f else None
+            is_usercombo = (field and field.tag == 'select' and
+                            field.attrs.get('class') == 'project-user-combobox')
+            if is_usercombo:
+                field.options = [('', False)] + [(u.username, False)
+                                                 for u in p.users()]
+
+        for k, v in kw.iteritems():
+            form['ticket_form.%s' % k] = v
+        resp = form.submit(extra_environ=extra_environ)
+        assert resp.status_int != 200, resp
+        return resp
+
+    @td.with_tool('test/sub1', 'Tickets', 'tickets')
+    def test_tickets_section(self):
+        self.new_ticket(summary="my ticket", _milestone='1.0', mount_point="/sub1/tickets/")
+        ThreadLocalORMSession.flush_all()
+        M.MonQTask.run_ready()
+        ThreadLocalORMSession.flush_all()
+        response = self.app.get('/dashboard')
+        ticket_rows = response.html.find('tbody')
+        assert_in('my ticket', str(ticket_rows))


Mime
View raw message