You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2014/02/27 03:14:38 UTC
svn commit: r1572404 [5/8] - in
/bloodhound/branches/bep_0007_embeddable_objects: ./ bloodhound_dashboard/
bloodhound_dashboard/bhdashboard/
bloodhound_dashboard/bhdashboard/default-pages/
bloodhound_dashboard/bhdashboard/layouts/ bloodhound_dashboard/...
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/resource.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/resource.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/resource.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/resource.py Thu Feb 27 02:14:33 2014
@@ -17,28 +17,28 @@
# specific language governing permissions and limitations
# under the License.
-from datetime import datetime
import os.path
import shutil
-from StringIO import StringIO
import tempfile
import unittest
+from StringIO import StringIO
+from datetime import datetime
+import trac.ticket.api
+import trac.ticket.report
+import trac.ticket.roadmap
+import trac.wiki.api
+from trac import resource
from trac.attachment import Attachment
-from trac import resource
-import trac.ticket.report # report resources ?
-import trac.ticket.roadmap # milestone resources
-import trac.ticket.api # ticket resources
from trac.ticket.model import Ticket
-from trac.ticket.tests.api import TicketSystemTestCase
from trac.util.datefmt import utc
-import trac.wiki.api # wiki resources
from trac.wiki.model import WikiPage
from multiproduct.api import MultiProductSystem
from multiproduct.env import ProductEnvironment
from tests.env import MultiproductTestCase
+
class ProductResourceTestCase(MultiproductTestCase):
def setUp(self):
self._mp_setup()
@@ -75,7 +75,7 @@ class ProductAttachmentResourceTestCase(
attachment = Attachment(self.env1, 'ticket', 1)
attachment.description = 'Product Bar'
attachment.insert('foo.txt', StringIO(''), 0)
- self.resource = resource.Resource('ticket',
+ self.resource = resource.Resource('ticket',
1).child('attachment', 'foo.txt')
def tearDown(self):
@@ -85,31 +85,31 @@ class ProductAttachmentResourceTestCase(
def test_global_neighborhood_attachments(self):
target = resource.Neighborhood('global', None).child(self.resource)
- self.assertEquals("[global:] Attachment 'foo.txt' in [global:] Ticket #1",
+ self.assertEquals("[global:] Attachment 'foo.txt' in [global:] Ticket #1",
resource.get_resource_description(self.env, target))
- self.assertEquals("[global:] Attachment 'foo.txt' in [global:] Ticket #1",
+ self.assertEquals("[global:] Attachment 'foo.txt' in [global:] Ticket #1",
resource.get_resource_name(self.env, target))
- self.assertEquals("[global:] foo.txt ([global:] Ticket #1)",
+ self.assertEquals("[global:] foo.txt ([global:] Ticket #1)",
resource.get_resource_shortname(self.env, target))
- self.assertEquals('Global Bar',
+ self.assertEquals('Global Bar',
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/attachment/ticket/1/foo.txt',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/attachment/ticket/1/foo.txt',
+ resource.get_resource_url(self.env,
target, self.env.href))
def test_product_neighborhood_attachments(self):
target = resource.Neighborhood('product', u'xü').child(self.resource)
- self.assertEquals(u"[product:xü] Attachment 'foo.txt' in [product:xü] Ticket #1",
+ self.assertEquals(u"[product:xü] Attachment 'foo.txt' in [product:xü] Ticket #1",
resource.get_resource_description(self.env, target))
- self.assertEquals(u"[product:xü] Attachment 'foo.txt' in [product:xü] Ticket #1",
+ self.assertEquals(u"[product:xü] Attachment 'foo.txt' in [product:xü] Ticket #1",
resource.get_resource_name(self.env, target))
- self.assertEquals(u"[product:xü] foo.txt ([product:xü] Ticket #1)",
+ self.assertEquals(u"[product:xü] foo.txt ([product:xü] Ticket #1)",
resource.get_resource_shortname(self.env, target))
- self.assertEquals('Product Bar',
+ self.assertEquals('Product Bar',
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/attachment/ticket/1/foo.txt',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/attachment/ticket/1/foo.txt',
+ resource.get_resource_url(self.env,
target, self.env.href))
@@ -119,31 +119,31 @@ class ProductMilestoneResourceTestCase(P
def test_global_neighborhood_milestone(self):
target = resource.Neighborhood('global', None).child(self.resource)
- self.assertEquals("[global:] Milestone milestone1",
+ self.assertEquals("[global:] Milestone milestone1",
resource.get_resource_description(self.env, target))
- self.assertEquals("[global:] Milestone milestone1",
+ self.assertEquals("[global:] Milestone milestone1",
resource.get_resource_name(self.env, target))
- self.assertEquals("milestone1",
+ self.assertEquals("milestone1",
resource.get_resource_shortname(self.env, target))
- self.assertEquals("[global:] Milestone milestone1",
+ self.assertEquals("[global:] Milestone milestone1",
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/milestone/milestone1',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/milestone/milestone1',
+ resource.get_resource_url(self.env,
target, self.env.href))
def test_product_neighborhood_milestone(self):
target = resource.Neighborhood('product', u'xü').child(self.resource)
- self.assertEquals(u"[product:xü] Milestone milestone1",
+ self.assertEquals(u"[product:xü] Milestone milestone1",
resource.get_resource_description(self.env, target))
- self.assertEquals(u"[product:xü] Milestone milestone1",
+ self.assertEquals(u"[product:xü] Milestone milestone1",
resource.get_resource_name(self.env, target))
- self.assertEquals(u"milestone1",
+ self.assertEquals(u"milestone1",
resource.get_resource_shortname(self.env, target))
- self.assertEquals(u"[product:xü] Milestone milestone1",
+ self.assertEquals(u"[product:xü] Milestone milestone1",
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/milestone/milestone1',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/milestone/milestone1',
+ resource.get_resource_url(self.env,
target, self.env.href))
@@ -154,31 +154,31 @@ class ProductReportResourceTestCase(Prod
def test_global_neighborhood_report(self):
target = resource.Neighborhood('global', None).child(self.resource)
- self.assertEquals("[global:] report:1",
+ self.assertEquals("[global:] report:1",
resource.get_resource_description(self.env, target))
- self.assertEquals("[global:] report:1",
+ self.assertEquals("[global:] report:1",
resource.get_resource_name(self.env, target))
- self.assertEquals("[global:] report:1",
+ self.assertEquals("[global:] report:1",
resource.get_resource_shortname(self.env, target))
- self.assertEquals('[global:] report:1 at version None',
+ self.assertEquals('[global:] report:1 at version None',
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/report/1',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/report/1',
+ resource.get_resource_url(self.env,
target, self.env.href))
def test_product_neighborhood_report(self):
target = resource.Neighborhood('product', u'xü').child(self.resource)
- self.assertEquals(u"[product:xü] report:1",
+ self.assertEquals(u"[product:xü] report:1",
resource.get_resource_description(self.env, target))
- self.assertEquals(u"[product:xü] report:1",
+ self.assertEquals(u"[product:xü] report:1",
resource.get_resource_name(self.env, target))
- self.assertEquals(u"[product:xü] report:1",
+ self.assertEquals(u"[product:xü] report:1",
resource.get_resource_shortname(self.env, target))
- self.assertEquals(u"[product:xü] report:1 at version None",
+ self.assertEquals(u"[product:xü] report:1 at version None",
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/report/1',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/report/1',
+ resource.get_resource_url(self.env,
target, self.env.href))
@@ -197,16 +197,16 @@ class ProductTicketResourceTestCase(Prod
type='enhancement', status='new')
target = nbh.child('ticket', self._new_ticket(self.global_env, data))
- self.assertEquals("[global:] Ticket #1",
+ self.assertEquals("[global:] Ticket #1",
resource.get_resource_description(self.env, target))
- self.assertEquals("[global:] Ticket #1",
+ self.assertEquals("[global:] Ticket #1",
resource.get_resource_name(self.env, target))
- self.assertEquals("[global:] #1",
+ self.assertEquals("[global:] #1",
resource.get_resource_shortname(self.env, target))
- self.assertEquals('enhancement: Ticket summary (new)',
+ self.assertEquals('enhancement: Ticket summary (new)',
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/ticket/1',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/ticket/1',
+ resource.get_resource_url(self.env,
target, self.env.href))
def test_product_neighborhood_ticket(self):
@@ -215,33 +215,19 @@ class ProductTicketResourceTestCase(Prod
type='task', status='accepted')
target = nbh.child('ticket', self._new_ticket(self.env1, data))
- self.assertEquals(u"[product:xü] Ticket #1",
+ self.assertEquals(u"[product:xü] Ticket #1",
resource.get_resource_description(self.env, target))
- self.assertEquals(u"[product:xü] Ticket #1",
+ self.assertEquals(u"[product:xü] Ticket #1",
resource.get_resource_name(self.env, target))
- self.assertEquals(u"[product:xü] #1",
+ self.assertEquals(u"[product:xü] #1",
resource.get_resource_shortname(self.env, target))
- self.assertEquals(u"task: Ticket summary (accepted)",
+ self.assertEquals(u"task: Ticket summary (accepted)",
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/ticket/1',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/ticket/1',
+ resource.get_resource_url(self.env,
target, self.env.href))
-#class ProductVcsResourceTestCase(ProductResourceTestCase):
-# def setUp(self):
-# pass
-#
-# def tearDown(self):
-# pass
-#
-# def test_global_neighborhood_versioncontrol(self):
-# raise NotImplementedError()
-#
-# def test_product_neighborhood_versioncontrol(self):
-# raise NotImplementedError()
-
-
class ProductWikiResourceTestCase(ProductResourceTestCase):
resource = resource.Resource('wiki', 'TestPage', version=2)
@@ -269,43 +255,54 @@ class ProductWikiResourceTestCase(Produc
def test_global_neighborhood_wiki(self):
target = resource.Neighborhood('global', None).child(self.resource)
- self.assertEquals("TestPage",
+ self.assertEquals("TestPage",
resource.get_resource_description(self.env, target))
- self.assertEquals("TestPage",
+ self.assertEquals("TestPage",
resource.get_resource_name(self.env, target))
- self.assertEquals("TestPage",
+ self.assertEquals("TestPage",
resource.get_resource_shortname(self.env, target))
- self.assertEquals("TestPage",
+ self.assertEquals("TestPage",
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/wiki/TestPage?version=2',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/wiki/TestPage?version=2',
+ resource.get_resource_url(self.env,
target, self.env.href))
def test_product_neighborhood_wiki(self):
target = resource.Neighborhood('product', u'xü').child(self.resource)
- self.assertEquals(u"TestPage",
+ self.assertEquals(u"TestPage",
resource.get_resource_description(self.env, target))
- self.assertEquals(u"TestPage",
+ self.assertEquals(u"TestPage",
resource.get_resource_name(self.env, target))
- self.assertEquals(u"TestPage",
+ self.assertEquals(u"TestPage",
resource.get_resource_shortname(self.env, target))
- self.assertEquals(u"TestPage",
+ self.assertEquals(u"TestPage",
resource.get_resource_summary(self.env, target))
- self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/wiki/TestPage?version=2',
- resource.get_resource_url(self.env,
+ self.assertEquals('http://example.org/trac.cgi/products/x%C3%BC/wiki/TestPage?version=2',
+ resource.get_resource_url(self.env,
target, self.env.href))
+class NeighborhoodTestCase(MultiproductTestCase):
+ def setUp(self):
+ self._mp_setup()
+
+ def test_get_known_neighborhoods(self):
+ rsys = resource.ResourceSystem(self.env)
+ self.assertEquals(['global', 'product'],
+ sorted(rsys.get_known_neighborhoods()))
+
+
def test_suite():
return unittest.TestSuite([
unittest.makeSuite(ProductAttachmentResourceTestCase, 'test'),
unittest.makeSuite(ProductMilestoneResourceTestCase, 'test'),
unittest.makeSuite(ProductReportResourceTestCase, 'test'),
unittest.makeSuite(ProductTicketResourceTestCase, 'test'),
-# unittest.makeSuite(ProductVcsResourceTestCase, 'test'),
unittest.makeSuite(ProductWikiResourceTestCase, 'test'),
+ unittest.makeSuite(NeighborhoodTestCase, 'test'),
])
+
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/__init__.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/__init__.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/__init__.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/__init__.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -22,4 +23,3 @@ from tests import TestLoader
def test_suite():
return TestLoader().discover_package(__name__, pattern='*.py')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/api.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/api.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/api.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/api.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -89,4 +90,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/batch.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/batch.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/batch.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/batch.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -16,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-"""Tests for Apache(TM) Bloodhound's tickets batch updates
+"""Tests for Apache(TM) Bloodhound's tickets batch updates
in product environments"""
import unittest
@@ -41,9 +42,9 @@ class ProductBatchModifyTestCase(BatchMo
self._load_product_from_data(self.global_env, self.default_product)
self.env = ProductEnvironment(self.global_env, self.default_product)
- self.global_env.enable_component_in_config(self.env,
+ self.global_env.enable_component_in_config(self.env,
ConfigurableTicketWorkflow)
- self.global_env.enable_component_in_config(self.env,
+ self.global_env.enable_component_in_config(self.env,
ProductTicketModule)
self._load_default_data(self.env)
@@ -63,4 +64,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/conversion.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/conversion.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/conversion.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/conversion.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -84,4 +85,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -158,7 +159,7 @@ class ProductMilestoneTestCase(Milestone
milestone.update()
self.assertEqual(
- [('Test', to_utimestamp(t1), to_utimestamp(t2), 'Foo bar',
+ [('Test', to_utimestamp(t1), to_utimestamp(t2), 'Foo bar',
self.default_product)],
self.env.db_query("SELECT * FROM milestone WHERE name='Test'"))
@@ -198,4 +199,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/notification.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/notification.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/notification.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/notification.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -16,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-"""Tests for Apache(TM) Bloodhound's tickets notifications
+"""Tests for Apache(TM) Bloodhound's tickets notifications
in product environments"""
import unittest
@@ -27,7 +28,7 @@ from trac.ticket.tests import notificati
from tests.env import ProductEnvironmentStub as ProductEnvironment
from tests.env import MultiproductTestCase
-class ProductNotificationTestCase(notification.NotificationTestCase,
+class ProductNotificationTestCase(notification.NotificationTestCase,
MultiproductTestCase):
@property
@@ -66,4 +67,3 @@ def test_suite():
if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(test_suite())
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/query.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/query.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/query.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/query.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -411,4 +412,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/report.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/report.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/report.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/report.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -57,4 +58,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/roadmap.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/roadmap.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/roadmap.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/roadmap.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -58,4 +59,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/wikisyntax.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/wikisyntax.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/wikisyntax.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/wikisyntax.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -31,30 +32,29 @@ from tests.wiki import formatter
def test_suite():
suite = unittest.TestSuite()
- suite.addTest(formatter.test_suite(wikisyntax.TICKET_TEST_CASES,
- wikisyntax.ticket_setup,
+ suite.addTest(formatter.test_suite(wikisyntax.TICKET_TEST_CASES,
+ wikisyntax.ticket_setup,
wikisyntax.__file__,
wikisyntax.ticket_teardown))
- suite.addTest(formatter.test_suite(wikisyntax.REPORT_TEST_CASES,
- wikisyntax.report_setup,
+ suite.addTest(formatter.test_suite(wikisyntax.REPORT_TEST_CASES,
+ wikisyntax.report_setup,
wikisyntax.__file__))
- suite.addTest(formatter.test_suite(wikisyntax.MILESTONE_TEST_CASES,
+ suite.addTest(formatter.test_suite(wikisyntax.MILESTONE_TEST_CASES,
wikisyntax.milestone_setup,
- wikisyntax.__file__,
+ wikisyntax.__file__,
wikisyntax.milestone_teardown))
- suite.addTest(formatter.test_suite(wikisyntax.QUERY_TEST_CASES,
- wikisyntax.ticket_setup,
+ suite.addTest(formatter.test_suite(wikisyntax.QUERY_TEST_CASES,
+ wikisyntax.ticket_setup,
wikisyntax.__file__,
wikisyntax.ticket_teardown))
- suite.addTest(formatter.test_suite(wikisyntax.QUERY2_TEST_CASES,
- wikisyntax.query2_setup,
+ suite.addTest(formatter.test_suite(wikisyntax.QUERY2_TEST_CASES,
+ wikisyntax.query2_setup,
wikisyntax.__file__,
wikisyntax.query2_teardown))
- suite.addTest(formatter.test_suite(wikisyntax.COMMENT_TEST_CASES,
+ suite.addTest(formatter.test_suite(wikisyntax.COMMENT_TEST_CASES,
file=wikisyntax.__file__))
return suite
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py Thu Feb 27 02:14:33 2014
@@ -17,17 +17,12 @@
# specific language governing permissions and limitations
# under the License.
-from sqlite3 import OperationalError
-from contextlib import contextmanager
import os
import shutil
-import sys
import tempfile
import uuid
-if sys.version_info < (2, 7):
- import unittest2 as unittest
-else:
- import unittest
+from contextlib import contextmanager
+from tests import unittest
from trac.attachment import Attachment, AttachmentAdmin
from trac.core import Component, implements
@@ -57,12 +52,12 @@ TABLES_WITH_PRODUCT_FIELD = (
class EnvironmentUpgradeTestCase(unittest.TestCase):
def setUp(self, options=()):
- self.env_path = tempfile.mkdtemp('multiproduct-tempenv')
- self.env = Environment(self.env_path, create=True, options=options)
+ env_path = tempfile.mkdtemp(prefix='bh-product-tempenv-')
+ self.env = Environment(env_path, create=True, options=options)
DummyPlugin.version = 1
def tearDown(self):
- shutil.rmtree(self.env_path)
+ shutil.rmtree(self.env.path)
def test_can_upgrade_environment_with_multi_product_disabled(self):
self.env.upgrade()
@@ -427,24 +422,24 @@ class EnvironmentUpgradeTestCase(unittes
def _update_config(self, section, key, value):
self.env.config.set(section, key, value)
self.env.config.save()
- self.env = Environment(self.env_path)
+ self.env = Environment(self.env.path)
def _create_file_with_content(self, content):
filename = str(uuid.uuid4())[:6]
- path = os.path.join(self.env_path, filename)
+ path = os.path.join(self.env.path, filename)
with open(path, 'wb') as f:
f.write(content)
return path
@contextmanager
def assertFailsWithMissingTable(self):
- with self.assertRaises(OperationalError) as cm:
+ with self.assertRaises(self.env.db_exc.OperationalError) as cm:
yield
self.assertIn('no such table', str(cm.exception))
@contextmanager
def assertFailsWithMissingColumn(self):
- with self.assertRaises(OperationalError) as cm:
+ with self.assertRaises(self.env.db_exc.OperationalError) as cm:
yield
self.assertIn('no such column', str(cm.exception))
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade_postgres.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade_postgres.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade_postgres.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade_postgres.py Thu Feb 27 02:14:33 2014
@@ -30,14 +30,10 @@ except Exception as err:
print err
database_available = False
+import upgrade
from contextlib import contextmanager
-import sys
-if sys.version_info < (2, 7):
- import unittest2 as unittest
-else:
- import unittest
+from tests import unittest
-import upgrade
@unittest.skipUnless(database_available, "Postgres database not available.")
class PostgresEnvironmentUpgradeTestCase(upgrade.EnvironmentUpgradeTestCase):
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/__init__.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/__init__.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/__init__.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/__init__.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -22,4 +23,3 @@ from tests import TestLoader
def test_suite():
return TestLoader().discover_package(__name__, pattern='*.py')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/api.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/api.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/api.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/api.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -27,7 +28,7 @@ from trac.versioncontrol.tests.api impor
from multiproduct.env import ProductEnvironment
from tests.env import MultiproductTestCase
-class ProductResourceManagerTestCase(ResourceManagerTestCase, \
+class ProductResourceManagerTestCase(ResourceManagerTestCase,
MultiproductTestCase):
@property
@@ -100,4 +101,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/cache.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/cache.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/cache.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/cache.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -16,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-"""Tests for Apache(TM) Bloodhound's repository cache in
+"""Tests for Apache(TM) Bloodhound's repository cache in
product environments"""
import unittest
@@ -56,4 +57,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/svn_authz.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/svn_authz.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/svn_authz.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/svn_authz.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -59,4 +60,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/__init__.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/__init__.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/__init__.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/__init__.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -22,4 +23,3 @@ from tests import TestLoader
def test_suite():
return TestLoader().discover_package(__name__, pattern='*.py')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/chrome.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/chrome.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/chrome.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/chrome.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -44,10 +45,10 @@ class ProductChromeTestCase(ChromeTestCa
pass
def setUp(self):
- # Instantiate environment stub before clearing ComponentMeta._registry
+ # Instantiate environment stub before clearing ComponentMeta._registry
self.env
ChromeTestCase.setUp(self)
-
+
def tearDown(self):
try:
try:
@@ -66,4 +67,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/session.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/session.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/session.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/session.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -55,4 +56,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/wikisyntax.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/wikisyntax.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/wikisyntax.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/wikisyntax.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -35,4 +36,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web_ui.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web_ui.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web_ui.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -32,9 +33,9 @@ from trac.web.main import RequestDispatc
from multiproduct.api import MultiProductSystem
from multiproduct.env import ProductEnvironment
+from multiproduct.hooks import ProductRequestWithSession
from multiproduct.model import Product
from multiproduct.web_ui import ProductModule
-from multiproduct.hooks import ProductRequestWithSession
from tests.env import MultiproductTestCase
@@ -95,26 +96,26 @@ class RequestHandlerTestCase(Multiproduc
def assertHttpHeaders(self, expectedHeaders):
for h, v in expectedHeaders.iteritems():
- self.assertTrue(h in self.http_headers,
+ self.assertTrue(h in self.http_headers,
"Expected HTTP header '%s' not set" % (h,))
- self.assertEquals(v, self.http_headers[h],
+ self.assertEquals(v, self.http_headers[h],
"Unexpected value for HTTP header '%s'" % (h,))
def assertRedirect(self, req, url, permanent=False):
if permanent:
- self.assertEquals('301 Moved Permanently', self.http_status,
+ self.assertEquals('301 Moved Permanently', self.http_status,
'Unexpected status code in HTTP redirect')
elif req.method == 'POST':
- self.assertEquals('303 See Other', self.http_status,
+ self.assertEquals('303 See Other', self.http_status,
'Unexpected status code in HTTP redirect')
else:
- self.assertEquals('302 Found', self.http_status,
+ self.assertEquals('302 Found', self.http_status,
'Unexpected status code in HTTP redirect')
- self.assertHttpHeaders({'Location' : url,
- 'Content-Type' : 'text/plain',
+ self.assertHttpHeaders({'Location' : url,
+ 'Content-Type' : 'text/plain',
'Content-Length' : '0',
- 'Pragma' : 'no-cache',
- 'Cache-Control' : 'no-cache',
+ 'Pragma' : 'no-cache',
+ 'Cache-Control' : 'no-cache',
'Expires' : 'Fri, 01 Jan 1999 00:00:00 GMT'})
@@ -294,7 +295,7 @@ class ProductModuleTestCase(RequestHandl
req.environ['REQUEST_METHOD'] = 'POST'
req.environ['PATH_INFO'] = '/products/%s' % (self.default_product,)
req.args = dict(action='edit', description='New description',
- prefix=self.default_product,
+ prefix=self.default_product,
name=self.env.product.name)
spy.testProcessing = assert_product_edit
@@ -306,7 +307,7 @@ class ProductModuleTestCase(RequestHandl
self._dispatch(req, self.global_env)
try:
- product = Product(self.global_env,
+ product = Product(self.global_env,
{'prefix' : self.env.product.prefix})
except ResourceNotFound:
self.fail('Default test product deleted ?')
@@ -342,4 +343,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/__init__.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/__init__.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/__init__.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/__init__.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -22,4 +23,3 @@ from tests import TestLoader
def test_suite():
return TestLoader().discover_package(__name__, pattern='*.py')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/formatter.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/formatter.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/formatter.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/formatter.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -44,9 +45,9 @@ class ProductWikiTestCase(formatter.Wiki
if self.context.req:
self.context.req.session = FakeSession()
if self.mpctx:
- candidates = set(self.mpctx.get('load_products', []) +
+ candidates = set(self.mpctx.get('load_products', []) +
[self.mpctx.get('main_product')])
- candidates -= set([self.default_product, None,
+ candidates -= set([self.default_product, None,
self.mpctx.get('setup_product')])
for prefix in candidates:
self._load_product_from_data(self.env, prefix)
@@ -55,7 +56,7 @@ class ProductWikiTestCase(formatter.Wiki
if prefix is None:
self.env = self.global_env
elif prefix is not NotImplemented \
- and (self.env is self.global_env or
+ and (self.env is self.global_env or
prefix != self.env.product.prefix):
self.env = ProductEnvironment(self.global_env, prefix)
# Enable multi-product components
@@ -120,21 +121,21 @@ class ProductWikiTestCase(formatter.Wiki
teardown=None, context=None, mpctx=None):
MultiproductTestCase.__init__(self, 'test')
self.mpctx = mpctx
- formatter.WikiTestCase.__init__(self, title, input, correct, file, line,
+ formatter.WikiTestCase.__init__(self, title, input, correct, file, line,
setup, teardown, context)
class ProductOneLinerTestCase(ProductWikiTestCase):
formatter = formatter.OneLinerTestCase.formatter.im_func
class ProductEscapeNewLinesTestCase(ProductWikiTestCase):
- generate_opts = formatter.EscapeNewLinesTestCase.generate_opts
+ generate_opts = formatter.EscapeNewLinesTestCase.generate_opts
formatter = formatter.EscapeNewLinesTestCase.formatter.im_func
class ProductOutlineTestCase(ProductWikiTestCase):
formatter = formatter.OutlineTestCase.formatter.im_func
-def test_suite(data=None, setup=None, file=formatter.__file__,
+def test_suite(data=None, setup=None, file=formatter.__file__,
teardown=None, context=None, mpctx=None):
suite = unittest.TestSuite()
def add_test_cases(data, filename):
@@ -187,4 +188,3 @@ def test_suite(data=None, setup=None, fi
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/macros.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/macros.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/macros.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/macros.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -16,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-"""Tests for inherited Apache(TM) Bloodhound's wiki macros
+"""Tests for inherited Apache(TM) Bloodhound's wiki macros
in product environments"""
import os.path
@@ -32,38 +33,38 @@ from tests.wiki import formatter
def test_suite():
suite = unittest.TestSuite()
suite.addTest(formatter.test_suite(
- macros.IMAGE_MACRO_TEST_CASES,
+ macros.IMAGE_MACRO_TEST_CASES,
file=macros.__file__))
suite.addTest(formatter.test_suite(
- macros.TITLEINDEX1_MACRO_TEST_CASES,
+ macros.TITLEINDEX1_MACRO_TEST_CASES,
file=macros.__file__))
suite.addTest(formatter.test_suite(
- macros.TITLEINDEX2_MACRO_TEST_CASES,
+ macros.TITLEINDEX2_MACRO_TEST_CASES,
file=macros.__file__,
setup=macros.titleindex2_setup,
teardown=macros.titleindex_teardown))
suite.addTest(formatter.test_suite(
- macros.TITLEINDEX3_MACRO_TEST_CASES,
+ macros.TITLEINDEX3_MACRO_TEST_CASES,
file=macros.__file__,
setup=macros.titleindex3_setup,
teardown=macros.titleindex_teardown))
suite.addTest(formatter.test_suite(
- macros.TITLEINDEX4_MACRO_TEST_CASES,
+ macros.TITLEINDEX4_MACRO_TEST_CASES,
file=macros.__file__,
setup=macros.titleindex4_setup,
teardown=macros.titleindex_teardown))
suite.addTest(formatter.test_suite(
- macros.TITLEINDEX5_MACRO_TEST_CASES,
+ macros.TITLEINDEX5_MACRO_TEST_CASES,
file=macros.__file__,
setup=macros.titleindex5_setup,
teardown=macros.titleindex_teardown))
suite.addTest(formatter.test_suite(
- macros.RECENTCHANGES_MACRO_TEST_CASES,
+ macros.RECENTCHANGES_MACRO_TEST_CASES,
file=macros.__file__,
setup=macros.recentchanges_setup,
teardown=macros.recentchanges_teardown))
suite.addTest(formatter.test_suite(
- macros.TRACINI_MACRO_TEST_CASES,
+ macros.TRACINI_MACRO_TEST_CASES,
file=macros.__file__,
setup=macros.tracini_setup,
teardown=macros.tracini_teardown))
@@ -72,4 +73,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/model.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/model.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/model.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/model.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -52,4 +53,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/wikisyntax.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/wikisyntax.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/wikisyntax.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/wikisyntax.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,5 @@
-
+# -*- coding: utf-8 -*-
+#
# 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
@@ -16,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-"""Tests for inherited Apache(TM) Bloodhound's wiki syntax
+"""Tests for inherited Apache(TM) Bloodhound's wiki syntax
in product environments"""
import os.path
@@ -31,19 +32,19 @@ from tests.wiki import formatter
def test_suite():
suite = unittest.TestSuite()
- suite.addTest(formatter.test_suite(wikisyntax.TEST_CASES,
+ suite.addTest(formatter.test_suite(wikisyntax.TEST_CASES,
wikisyntax.wiki_setup, wikisyntax.__file__,
wikisyntax.wiki_teardown))
- suite.addTest(formatter.test_suite(wikisyntax.RELATIVE_LINKS_TESTS,
+ suite.addTest(formatter.test_suite(wikisyntax.RELATIVE_LINKS_TESTS,
wikisyntax.wiki_setup, wikisyntax.__file__,
wikisyntax.wiki_teardown,
context=('wiki', 'Main/Sub')))
- suite.addTest(formatter.test_suite(wikisyntax.SPLIT_PAGE_NAMES_TESTS,
- wikisyntax.wiki_setup_split,
- wikisyntax.__file__,
+ suite.addTest(formatter.test_suite(wikisyntax.SPLIT_PAGE_NAMES_TESTS,
+ wikisyntax.wiki_setup_split,
+ wikisyntax.__file__,
wikisyntax.wiki_teardown,
context=('wiki', 'Main/Sub')))
- suite.addTest(formatter.test_suite(wikisyntax.SCOPED_LINKS_TESTS,
+ suite.addTest(formatter.test_suite(wikisyntax.SCOPED_LINKS_TESTS,
wikisyntax.wiki_setup, wikisyntax.__file__,
wikisyntax.wiki_teardown,
context=('wiki',
@@ -53,4 +54,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wikisyntax.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wikisyntax.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wikisyntax.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wikisyntax.py Thu Feb 27 02:14:33 2014
@@ -76,7 +76,7 @@ def ticket_setup(tc):
PRODUCT_LINKS = to_unicode(pkg_resources.resource_string(
__name__, 'product-link-tests.txt'))
PRODUCT_ATTACHMENT_LINKS = to_unicode(pkg_resources.resource_string(
- __name__, 'product-attachment-link-tests.txt'))
+ __name__, 'product-attachment-link-tests.txt'))
PRODUCT_SEARCH_LINKS = to_unicode(pkg_resources.resource_string(
__name__, 'product-search-link-tests.txt'))
PRODUCT_TICKET_LINKS = to_unicode(pkg_resources.resource_string(
@@ -96,7 +96,7 @@ PRODUCT_COMMENT_LINKS = to_unicode(pkg_r
# Compact syntax
PRODUCT_ATTACHMENT_SHORTLINKS = to_unicode(pkg_resources.resource_string(
- __name__, 'product-attachment-link-tests.short.txt'))
+ __name__, 'product-attachment-link-tests.short.txt'))
PRODUCT_SEARCH_SHORTLINKS = to_unicode(pkg_resources.resource_string(
__name__, 'product-search-link-tests.short.txt'))
PRODUCT_TICKET_SHORTLINKS = to_unicode(pkg_resources.resource_string(
@@ -117,7 +117,7 @@ PRODUCT_PREFIXES = MultiproductTestCase.
PRODUCT_PREFIXES.remove(MultiproductTestCase.default_product)
def clear_base_href_setup(tc):
- tc.global_env.href = Href('/')
+ tc.global_env.href = Href('/')
tc.global_env.abs_href = Href('http://www.example.com/')
if tc.env is not tc.global_env:
del tc.env.abs_href
@@ -143,7 +143,7 @@ def link_mp_setup(_setup):
# Product testing contexts explained
#
# Product testing contexts are a hack used to hijack the mechanism
-# used by Trac test suite in order to run wiki test cases in product context
+# used by Trac test suite in order to run wiki test cases in product context
#
# title_prefix : prepend this text to test case summary
# link_prefix : used to put link references in given product context
@@ -151,10 +151,10 @@ def link_mp_setup(_setup):
# path_prefix : prepended to URLs expanded using `link_prefix`
# main_product : prefix identifying the product bound to test case
# `env` attribute
-# setup_product : optional prefix of the product that will be setup
+# setup_product : optional prefix of the product that will be setup
# i.e. the product under test
# load_products : optional product prefixes list to load at setup time
-# *_product_name : target product name (e.g. setup_product_name )
+# *_product_name : target product name (e.g. setup_product_name )
# *_escaped : escaped forms used to match output
TEST_PRODUCT_CONTEXTS = [
{'tc_title_prefix' : 'product: links',
@@ -231,14 +231,14 @@ def test_suite():
suite = unittest.TestSuite()
# Legacy test cases
- suite.addTest(formatter.test_suite(wikisyntax.SEARCH_TEST_CASES,
+ suite.addTest(formatter.test_suite(wikisyntax.SEARCH_TEST_CASES,
file=wikisyntax.__file__))
- suite.addTest(formatter.test_suite(wikisyntax.ATTACHMENT_TEST_CASES,
+ suite.addTest(formatter.test_suite(wikisyntax.ATTACHMENT_TEST_CASES,
file=wikisyntax.__file__,
context=('wiki', 'WikiStart'),
setup=attachment_setup,
teardown=attachment_teardown))
- suite.addTest(formatter.test_suite(wikisyntax.EMAIL_TEST_CASE_DEFAULT,
+ suite.addTest(formatter.test_suite(wikisyntax.EMAIL_TEST_CASE_DEFAULT,
file=wikisyntax.__file__,
context=wikisyntax.email_default_context()))
suite.addTest(formatter.test_suite(wikisyntax.EMAIL_TEST_CASE_NEVER_OBFUSCATE,
@@ -247,55 +247,55 @@ def test_suite():
setup=wikisyntax.email_never_obfuscate_setup))
# Product wiki syntax
- suite.addTest(formatter.test_suite(PRODUCT_LINKS,
+ suite.addTest(formatter.test_suite(PRODUCT_LINKS,
setup=load_products_setup(PRODUCT_PREFIXES),
file=__file__))
- suite.addTests(formatter.test_suite(PRODUCT_SEARCH_LINKS % ctx,
+ suite.addTests(formatter.test_suite(PRODUCT_SEARCH_LINKS % ctx,
file=__file__,
setup=clear_base_href_setup,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS)
- suite.addTests(formatter.test_suite(PRODUCT_ATTACHMENT_LINKS % ctx,
+ suite.addTests(formatter.test_suite(PRODUCT_ATTACHMENT_LINKS % ctx,
file=__file__,
context=('wiki', 'WikiStart'),
setup=link_mp_setup(attachment_setup),
teardown=attachment_teardown,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS)
- suite.addTests(formatter.test_suite(PRODUCT_TICKET_LINKS % ctx,
- link_mp_setup(ticket_wikisyntax.ticket_setup),
+ suite.addTests(formatter.test_suite(PRODUCT_TICKET_LINKS % ctx,
+ link_mp_setup(ticket_wikisyntax.ticket_setup),
__file__,
# No need to invoke it anymore
# ticket_wikisyntax.ticket_teardown,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS)
- suite.addTests(formatter.test_suite(PRODUCT_TICKET_JIRA % ctx,
- link_mp_setup(ticket_wikisyntax.ticket_setup),
+ suite.addTests(formatter.test_suite(PRODUCT_TICKET_JIRA % ctx,
+ link_mp_setup(ticket_wikisyntax.ticket_setup),
__file__,
# No need to invoke it anymore
# ticket_wikisyntax.ticket_teardown,
mpctx=ctx)
- for ctx in TEST_PRODUCT_CONTEXTS
+ for ctx in TEST_PRODUCT_CONTEXTS
if ctx['path_prefix'])
- suite.addTests(formatter.test_suite(PRODUCT_REPORT_LINKS % ctx,
- link_mp_setup(ticket_wikisyntax.report_setup),
+ suite.addTests(formatter.test_suite(PRODUCT_REPORT_LINKS % ctx,
+ link_mp_setup(ticket_wikisyntax.report_setup),
__file__,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS)
- suite.addTests(formatter.test_suite(PRODUCT_MILESTONE_LINKS % ctx,
+ suite.addTests(formatter.test_suite(PRODUCT_MILESTONE_LINKS % ctx,
link_mp_setup(ticket_wikisyntax.milestone_setup),
- __file__,
+ __file__,
ticket_wikisyntax.milestone_teardown,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS)
- suite.addTests(formatter.test_suite(PRODUCT_QUERY_LINKS % ctx,
- link_mp_setup(ticket_setup),
+ suite.addTests(formatter.test_suite(PRODUCT_QUERY_LINKS % ctx,
+ link_mp_setup(ticket_setup),
__file__,
ticket_wikisyntax.ticket_teardown,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS)
- suite.addTests(formatter.test_suite(PRODUCT_QUERY2_LINKS % ctx,
- link_mp_setup(ticket_wikisyntax.query2_setup),
+ suite.addTests(formatter.test_suite(PRODUCT_QUERY2_LINKS % ctx,
+ link_mp_setup(ticket_wikisyntax.query2_setup),
__file__,
ticket_wikisyntax.query2_teardown,
mpctx=ctx)
@@ -308,39 +308,39 @@ def test_suite():
# Compact syntax
- suite.addTests(formatter.test_suite(PRODUCT_SEARCH_SHORTLINKS % ctx,
+ suite.addTests(formatter.test_suite(PRODUCT_SEARCH_SHORTLINKS % ctx,
file=__file__,
setup=clear_base_href_setup,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
- suite.addTests(formatter.test_suite(PRODUCT_ATTACHMENT_SHORTLINKS % ctx,
+ suite.addTests(formatter.test_suite(PRODUCT_ATTACHMENT_SHORTLINKS % ctx,
file=__file__,
context=('wiki', 'WikiStart'),
setup=link_mp_setup(attachment_setup),
teardown=attachment_teardown,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
- suite.addTests(formatter.test_suite(PRODUCT_TICKET_SHORTLINKS % ctx,
- link_mp_setup(ticket_wikisyntax.ticket_setup),
+ suite.addTests(formatter.test_suite(PRODUCT_TICKET_SHORTLINKS % ctx,
+ link_mp_setup(ticket_wikisyntax.ticket_setup),
__file__,
# No need to invoke it anymore
# ticket_wikisyntax.ticket_teardown,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
- suite.addTests(formatter.test_suite(PRODUCT_REPORT_SHORTLINKS % ctx,
- link_mp_setup(ticket_wikisyntax.report_setup),
+ suite.addTests(formatter.test_suite(PRODUCT_REPORT_SHORTLINKS % ctx,
+ link_mp_setup(ticket_wikisyntax.report_setup),
__file__,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
- suite.addTests(formatter.test_suite(PRODUCT_MILESTONE_SHORTLINKS % ctx,
+ suite.addTests(formatter.test_suite(PRODUCT_MILESTONE_SHORTLINKS % ctx,
link_mp_setup(ticket_wikisyntax.milestone_setup),
- __file__,
+ __file__,
ticket_wikisyntax.milestone_teardown,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
- suite.addTests(formatter.test_suite(PRODUCT_QUERY_SHORTLINKS % ctx,
- link_mp_setup(ticket_setup),
+ suite.addTests(formatter.test_suite(PRODUCT_QUERY_SHORTLINKS % ctx,
+ link_mp_setup(ticket_setup),
__file__,
ticket_wikisyntax.ticket_teardown,
mpctx=ctx)
@@ -361,4 +361,3 @@ def test_suite():
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/__init__.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/__init__.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/__init__.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/__init__.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
@@ -17,4 +16,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
@@ -25,6 +24,7 @@ from pkg_resources import resource_filen
from bhrelations import db_default
from bhrelations.model import Relation
from bhrelations.utils import unique
+from bhrelations.utils.translation import _, add_domain
from multiproduct.api import ISupportMultiProductEnvironment
from multiproduct.model import Product
from multiproduct.env import ProductEnvironment
@@ -37,6 +37,7 @@ from trac.db import DatabaseManager
from trac.resource import (ResourceSystem, Resource, ResourceNotFound,
get_resource_shortname, Neighborhood)
from trac.ticket import Ticket, ITicketManipulator, ITicketChangeListener
+from trac.ticket.api import TicketSystem
from trac.util.datefmt import utc, to_utimestamp
from trac.web.chrome import ITemplateProvider
@@ -199,16 +200,21 @@ class RelationsSystem(Component):
'NoSelfReferenceValidator, ExclusiveValidator, BlockerValidator',
include_missing=False,
doc="""Validators used to validate all relations,
- regardless of their type."""
+ regardless of their type.""",
+ doc_domain='bhrelations'
)
duplicate_relation_type = Option(
'bhrelations',
'duplicate_relation',
'duplicateof',
- "Relation type to be used with the resolve as duplicate workflow.")
+ "Relation type to be used with the resolve as duplicate workflow.",
+ doc_domain='bhrelations')
def __init__(self):
+ import pkg_resources
+ locale_dir = pkg_resources.resource_filename(__name__, 'locale')
+ add_domain(self.env.path, locale_dir)
links, labels, validators, blockers, copy_fields, exclusive = \
self._parse_config()
self._links = links
@@ -492,10 +498,9 @@ class TicketRelationsSpecifics(Component
pass
def ticket_changed(self, ticket, comment, author, old_values):
- if (
- self._closed_as_duplicate(ticket) and
- self.rls.duplicate_relation_type
- ):
+ if self._closed_as_duplicate(ticket) and \
+ self.rls.duplicate_relation_type and \
+ hasattr(ticket, 'duplicate'): # workaround for comment:5:ticket:710
try:
self.rls.add(ticket, ticket.duplicate,
self.rls.duplicate_relation_type,
@@ -522,7 +527,9 @@ class TicketRelationsSpecifics(Component
)
def _check_blockers(self, req, ticket):
- if req.args.get('action') == 'resolve':
+ action = req.args.get('action')
+ operations = self._get_operations_for_action(req, ticket, action)
+ if 'set_resolution' in operations:
blockers = self.rls.find_blockers(ticket, self.is_blocker)
if blockers:
blockers_str = ', '.join(
@@ -534,18 +541,23 @@ class TicketRelationsSpecifics(Component
yield None, msg
def _check_open_children(self, req, ticket):
- if req.args.get('action') == 'resolve':
+ action = req.args.get('action')
+ operations = self._get_operations_for_action(req, ticket, action)
+ if 'set_resolution' in operations:
for relation in [r for r in self.rls.get_relations(ticket)
if r['type'] == self.rls.CHILDREN_RELATION_TYPE]:
- ticket = self._create_ticket_by_full_id(relation['destination'])
- if ticket['status'] != 'closed':
- msg = ("Cannot resolve this ticket because it has open"
+ child_ticket = \
+ self._create_ticket_by_full_id(relation['destination'])
+ if child_ticket['status'] != 'closed':
+ msg = ("Cannot resolve this ticket because it has open "
"child tickets.")
yield None, msg
def _check_duplicate_id(self, req, ticket):
- if req.args.get('action') == 'resolve':
- resolution = req.args.get('action_resolve_resolve_resolution')
+ action = req.args.get('action')
+ operations = self._get_operations_for_action(req, ticket, action)
+ if 'set_resolution' in operations:
+ resolution = req.args.get('action_%s_resolve_resolution' % action)
if resolution == 'duplicate':
duplicate_id = req.args.get('duplicate_id')
if not duplicate_id:
@@ -559,25 +571,42 @@ class TicketRelationsSpecifics(Component
except NoSuchTicketError:
yield None, "Invalid duplicate ticket ID."
+ def _get_operations_for_action(self, req, ticket, action):
+ operations = []
+ for controller in TicketSystem(self.env).action_controllers:
+ actions = [a for w, a in
+ controller.get_ticket_actions(req, ticket) or []]
+ if action in actions:
+ operations += controller.actions[action]['operations']
+ return operations
+
def find_ticket(self, ticket_spec):
ticket = None
- m = re.match(r'#?(?P<tid>\d+)', ticket_spec)
+ m = re.match(r'#?(?:(?P<pid>[^-]+)-)?(?P<tid>\d+)', ticket_spec)
if m:
+ pid = m.group('pid')
tid = m.group('tid')
- try:
- ticket = Ticket(self.env, tid)
- except ResourceNotFound:
- # ticket not found in current product, try all other products
- for p in Product.select(self.env):
- if p.prefix != self.env.product.prefix:
- # TODO: check for PRODUCT_VIEW permissions
- penv = ProductEnvironment(self.env.parent, p.prefix)
- try:
- ticket = Ticket(penv, tid)
- except ResourceNotFound:
- pass
- else:
- break
+ if pid:
+ try:
+ env = ProductEnvironment(self.env.parent, pid)
+ ticket = Ticket(env, tid)
+ except:
+ pass
+ else:
+ try:
+ ticket = Ticket(self.env, tid)
+ except ResourceNotFound:
+ # ticket not found in current product, try all other products
+ for p in Product.select(self.env):
+ if p.prefix != self.env.product.prefix:
+ # TODO: check for PRODUCT_VIEW permissions
+ penv = ProductEnvironment(self.env.parent, p.prefix)
+ try:
+ ticket = Ticket(penv, tid)
+ except ResourceNotFound:
+ pass
+ else:
+ break
# ticket still not found, use fallback for <prefix>:ticket:<id> syntax
if ticket is None:
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/db_default.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/db_default.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/db_default.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/db_default.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
@@ -26,4 +25,4 @@ DB_VERSION = 2
SCHEMA = [mcls._get_schema() for mcls in (Relation, )]
migrations = [
-]
\ No newline at end of file
+]
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/model.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/model.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/model.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/model.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
@@ -17,6 +16,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+
from bhdashboard.model import ModelBase
from trac.resource import Resource
from trac.util.datefmt import to_utimestamp, from_utimestamp
@@ -24,19 +24,20 @@ from trac.util.datefmt import to_utimest
class Relation(ModelBase):
"""The Relation table"""
- RELATION_ID_DELIMITER = u","
+ RELATION_ID_DELIMITER = u','
- _meta = {'table_name':'bloodhound_relations',
- 'object_name':'Relation',
- 'key_fields':['source', 'type', 'destination'],
- 'non_key_fields':[
- 'comment',
- 'author',
- {'name': 'time','type': 'int64'},
- ],
- 'no_change_fields':['source', 'destination', 'type'],
- 'unique_fields':[],
- }
+ _meta = {
+ 'table_name': 'bloodhound_relations',
+ 'object_name': 'Relation',
+ 'key_fields': ['source', 'type', 'destination'],
+ 'non_key_fields': [
+ 'comment',
+ 'author',
+ {'name': 'time', 'type': 'int64'},
+ ],
+ 'no_change_fields': ['source', 'destination', 'type'],
+ 'unique_fields': [],
+ }
@property
def resource(self):
@@ -45,7 +46,7 @@ class Relation(ModelBase):
@property
def when(self):
- when_ts = self._data.get("time")
+ when_ts = self._data.get('time')
if when_ts is not None:
return from_utimestamp(when_ts)
return None
@@ -57,9 +58,9 @@ class Relation(ModelBase):
def clone_reverted(self, type):
data = self._data.copy()
- data["type"] = type
- data["source"] = self.destination
- data["destination"] = self.source
+ data['type'] = type
+ data['source'] = self.destination
+ data['destination'] = self.source
relation = Relation(self._env)
# pylint: disable=protected-access
relation._data = data
@@ -92,7 +93,7 @@ class Relation(ModelBase):
source=source,
destination=destination,
type=relation_type
- ))
+ ))
def __str__(self):
return '%s %s %s' % (self.source, self.type, self.destination)
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/notification.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/notification.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/notification.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/notification.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/search.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/search.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/search.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/search.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
@@ -18,8 +17,6 @@
# specific language governing permissions and limitations
# under the License.
-from sqlite3 import OperationalError
-
from trac.core import Component, implements
from bhsearch.api import IDocIndexPreprocessor
@@ -42,7 +39,7 @@ class RelationsDocPreprocessor(Component
for relation in rls._select_relations(resource_id):
relations.extend(self._format_relations(relation))
doc['relations'] = ','.join(relations)
- except OperationalError:
+ except self.env.db_exc.OperationalError:
# If bhrelations and bhsearch are installed at the same time and
# bhsearch is upgraded before bhrelations, table
# bloodhound_relations will be missing, thus causing the
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/templates/relations_manage.html
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/templates/relations_manage.html?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/templates/relations_manage.html (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/templates/relations_manage.html Thu Feb 27 02:14:33 2014
@@ -24,21 +24,22 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:py="http://genshi.edgewall.org/"
xmlns:i18n="http://genshi.edgewall.org/i18n"
+ i18n:domain="bhrelations"
xmlns:bh="http://issues.apache.org/bloodhound/wiki/Ui/Dashboard">
<xi:include href="layout.html" />
<xi:include href="widget_macros.html" />
<head>
- <title py:choose="">Ticket relations for #${ticket.id}</title>
+ <title py:choose="" i18n:msg="ticket_id">Ticket relations for #${ticket.id}</title>
</head>
<body>
- <h1>Manage relations for ticket <a href="${href.ticket(ticket.id)}">#$ticket.id</a></h1>
+ <h1 i18n:msg="ticket_id">Manage relations for ticket <a href="${href.ticket(ticket.id)}">#$ticket.id</a></h1>
<div class="row">
<div class="span8">
<py:if test='error'>
- <div class="alert alert-error">
+ <div class="alert alert-error" i18n:msg="error">
<span class="label label-important">Oops !</span>
Could not create relation.
$error
@@ -96,14 +97,16 @@
<tbody py:for="relgroup,items in relations.iteritems()">
<tr py:for="item in items">
<td class="sel"><input type="checkbox" name="sel" value="${item.relation_id}" /></td>
- <td>${relgroup if items.index(item) == 0 else None}</td>
+ <td>$relgroup</td>
<td>
<a href="${href.products(item['destticket'].env.product.prefix)}">
<span class="hidden-phone">${item['destticket'].env.product.name} (${item['destticket'].env.product.prefix})</span>
<span class="visible-phone">${item['destticket'].env.product.prefix}</span>
</a>
</td>
- <td><a href="${item['desthref']}">#${item['destticket'].id}</a> - ${item['destticket'].summary}</td>
+ <td><a href="${item['desthref']}" class="${classes(item['destticket'].status, 'ticket')}">
+ ${get_resource_shortname(item['destticket'].env, item['destticket'].resource)}</a> - ${get_resource_summary(item['destticket'].env, item['destticket'].resource)}
+ </td>
<td>$item.comment</td>
<td>$item.author</td>
<td class="hidden-phone">${pretty_dateinfo(item.when)}</td>
Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/__init__.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/__init__.py?rev=1572404&r1=1572403&r2=1572404&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/__init__.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/__init__.py Thu Feb 27 02:14:33 2014
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
@@ -41,4 +40,3 @@ if __name__ == '__main__':
unittest.main(defaultTest='suite')
else:
test_suite = suite()
-