1. Olemis Lang
  2. trac-gviz

Commits

Olemis Lang  committed 9aaee1c

GViz providers : Improved test cases for timeline event/filters RPC on Trac=1.0 ... FAILED (failures=20, errors=30)

Also improved Trac=1.0 EnvironmentStub approach to enable/disable components after [a517793eb127]

  • Participants
  • Parent commits ad815b8
  • Branches providers

Comments (0)

Files changed (3)

File trac-dev/gviz/TODO

View file
   expose data under version control (`svn` + `hg` + `git` ? + `mtn` + 
   `bzr` ? ) like `VersionControlRPC`. Include example repos.
 
+- Write tests against `VersionControlRPC` for multi-repository support.
+
 - Unify test loaders.
 
 - Implement clonation of `dutest.DocTestLoader`s.
 
 - Export data to Google Spreadsheets.
 
-- Upgrade RPC providers test cases against Trac=1.0 and Apache(TM) Bloodhound.
+- Upgrade RPC providers for Trac=1.0 and Apache(TM) Bloodhound.
 
-- Upgrade GViz providers test cases against Trac=1.0 and Apache(TM) Bloodhound.
+- Upgrade GViz providers fot Trac=1.0 and Apache(TM) Bloodhound.
 

File trac-dev/gviz/tracgviz/testing/__init__.py

View file
 
 r"""Test artifacts.
 
-The test suites have been run using Trac=0.11.1.
+The test suites have been run using ~~Trac=0.11.1~~ Trac=1.0 .
 
 Copyright 2009-2011 Olemis Lang <olemis at gmail.com>
 Licensed under the Apache License, Version 2.0 
     r"""Enable a plugin temporarily at testing time.
     """
     self.config.set('components', clsdef, 'enabled')
+    del self._rules
   
   def disable_component(self, clsdef):
     r"""Disable a plugin temporarily at testing time.
     """
     self.config.set('components', clsdef, 'disabled')
+    del self._rules
 
   def rip_component(self, cls):
     r"""Disable a plugin forever and RIP it using the super-laser beam.

File trac-dev/gviz/tracgviz/testing/test_rpc.py

View file
 
 __test__ = {
     '|timeline: Event filters' : r"""
+      # Disable version control ... for a while ;o)
+      >>> env.enabled.clear()                     # Clear cache
+      >>> env.disable_component('trac.versioncontrol.web_ui.changeset.*')
+      >>> from trac.versioncontrol.web_ui.changeset import ChangesetModule
+      >>> env[ChangesetModule] is None
+      True
+      
       >>> print_timeline_filters(rpcobj)
-      ('milestone', 'Milestones')
-      ('ticket', 'Ticket changes')
+      ('milestone', 'Milestones reached')
+      ('ticket', 'Tickets opened and closed')
       ('wiki', 'Wiki changes')
       
       # Enable version control ... for a while ;o)
       >>> env.enabled.clear()                     # Clear cache
-      >>> sel = 'trac.v*'
-      >>> env.enable_component(sel)
+      >>> env.enable_component('trac.versioncontrol.web_ui.changeset.*')
       
       >>> print_timeline_filters(rpcobj)
-      ('changeset', 'Repository checkins')
-      ('milestone', 'Milestones')
-      ('ticket', 'Ticket changes')
+      ('changeset', 'Repository changesets')
+      ('milestone', 'Milestones reached')
+      ('ticket', 'Tickets opened and closed')
       ('wiki', 'Wiki changes')
       
       >>> from trac.core import Component, implements
       
       >>> env.enable_component(TestTimelineProvider)
       >>> print_timeline_filters(rpcobj)
-      ('changeset', 'Repository checkins')
-      ('milestone', 'Milestones')
+      ('changeset', 'Repository changesets')
+      ('milestone', 'Milestones reached')
       ('test_tracgviz', 'Testing ternary tuples in filters')
-      ('ticket', 'Ticket changes')
+      ('ticket', 'Tickets opened and closed')
       ('wiki', 'Wiki changes')
       
       >>> env.config.set('timeline', 'ticket_show_details', 'true')
       >>> env.config.save()
       >>> print_timeline_filters(rpcobj)
-      ('changeset', 'Repository checkins')
-      ('milestone', 'Milestones')
+      ('changeset', 'Repository changesets')
+      ('milestone', 'Milestones reached')
       ('test_tracgviz', 'Testing ternary tuples in filters')
-      ('ticket', 'Ticket changes')
-      ('ticket_details', 'Ticket details')
+      ('ticket', 'Tickets opened and closed')
+      ('ticket_details', 'Ticket updates')
       ('wiki', 'Wiki changes')
       
       # Clean up a little
       >>> env.config.save()
       
       >>> print_timeline_filters(rpcobj)
-      ('milestone', 'Milestones')
-      ('ticket', 'Ticket changes')
+      ('changeset', 'Repository changesets')
+      ('milestone', 'Milestones reached')
+      ('ticket', 'Tickets opened and closed')
       ('wiki', 'Wiki changes')
       """,
     '|timeline: Retrieving wiki events' : r"""
       >>> page.save('murphy', 'New wiki page', '127.0.0.1')
       
       >>> print_timeline_events(rpcobj.getEvents(timestamp, None, ['wiki']))
-      ['wiki', u'murphy', '...', ..., 'http://example.org/trac.cgi/wiki/TestPage?version=1', '<em>TestPage</em> created', 'New wiki page']
+      ['wiki', u'murphy', '...', ..., 'http://example.org/trac.cgi/wiki/TestPage?version=1', '<em>TestPage</em> created', '<p>\nNew wiki page\n</p>\n']
       
       >>> from trac.util.datefmt import _epoc
       >>> print_timeline_events(rpcobj.getEvents(_epoc, timestamp, ['wiki']))
     '|timeline: Retrieving milestone events' : r"""
       # A few milestones should be there at startup ;o)
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['milestone']))   # Default milestones
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone1', 'Milestone <em>milestone1</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone2', 'Milestone <em>milestone2</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone3', 'Milestone <em>milestone3</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone4', 'Milestone <em>milestone4</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone1', 'Milestone <em>milestone1</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone2', 'Milestone <em>milestone2</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone3', 'Milestone <em>milestone3</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone4', 'Milestone <em>milestone4</em> completed', '']
       
       # Remember this glorious moment, don't you dare to sleep !
       >>> from trac.util.datefmt import localtz
       >>> m.insert()
       
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['milestone']))   # After insert
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone1', 'Milestone <em>milestone1</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone2', 'Milestone <em>milestone2</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone3', 'Milestone <em>milestone3</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone4', 'Milestone <em>milestone4</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/World-wide%20domination', 'Milestone <em>World-wide domination</em> completed', "<p>\r\nI'll rule the world. My Trac is my weapon\r\n</p>\r\n"]
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone1', 'Milestone <em>milestone1</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone2', 'Milestone <em>milestone2</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone3', 'Milestone <em>milestone3</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone4', 'Milestone <em>milestone4</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/World-wide%20domination', 'Milestone <em>World-wide domination</em> completed', "<p>\nI'll rule the world. My Trac is my weapon\n</p>\n"]
       
       # Consider it done ! :P
       >>> m._fetch(m.name)
       >>> timestamp = timestamp.replace(year=timestamp.year - 2)
       
       >>> print_timeline_events(rpcobj.getEvents(timestamp, None, ['milestone']))
-      ['milestone', '', '20...', ..., 'http://example.org/trac.cgi/milestone/World-wide%20domination', 'Milestone <em>World-wide domination</em> completed', "<p>\r\nI'll rule the world. My Trac is my weapon\r\n</p>\r\n"]
+      ['milestone', '', '2...', ..., 'http://example.org/trac.cgi/milestone/World-wide%20domination', 'Milestone <em>World-wide domination</em> completed', "<p>\nI'll rule the world. My Trac is my weapon\n</p>\n"]
       
       >>> from trac.util.datefmt import _epoc
       >>> print_timeline_events(rpcobj.getEvents(_epoc, timestamp, ['milestone']))
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone1', 'Milestone <em>milestone1</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone2', 'Milestone <em>milestone2</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone3', 'Milestone <em>milestone3</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone4', 'Milestone <em>milestone4</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone1', 'Milestone <em>milestone1</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone2', 'Milestone <em>milestone2</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone3', 'Milestone <em>milestone3</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone4', 'Milestone <em>milestone4</em> completed', '']
       
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['milestone']))   # All events
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone1', 'Milestone <em>milestone1</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone2', 'Milestone <em>milestone2</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone3', 'Milestone <em>milestone3</em> completed', '']
-      ['milestone', '', '1970-01-01 00:00:00+00:00', 0, 'http://example.org/trac.cgi/milestone/milestone4', 'Milestone <em>milestone4</em> completed', '']
-      ['milestone', '', '20...', ..., 'http://example.org/trac.cgi/milestone/World-wide%20domination', 'Milestone <em>World-wide domination</em> completed', "<p>\r\nI'll rule the world. My Trac is my weapon\r\n</p>\r\n"]
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone1', 'Milestone <em>milestone1</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone2', 'Milestone <em>milestone2</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone3', 'Milestone <em>milestone3</em> completed', '']
+      ['milestone', '', '1970-01-01 00:00:00+00:00', 0L, 'http://example.org/trac.cgi/milestone/milestone4', 'Milestone <em>milestone4</em> completed', '']
+      ['milestone', '', '2...', ..., 'http://example.org/trac.cgi/milestone/World-wide%20domination', 'Milestone <em>World-wide domination</em> completed', "<p>\nI'll rule the world. My Trac is my weapon\n</p>\n"]
       """,
     '|timeline: Retrieving ticket events' : r"""
       # Open tickets
       >>> env.config.save()
       
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['ticket']))
-      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', 'God bless the devs who test their Trac plugins using dutest']
+      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', '<p>\nGod bless the devs who test their Trac plugins using dutest<br />\n</p>\n']
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['ticket_details']))
       
       # Another change ...
       >>> for attrnm, val in sorted(attrs.iteritems()):
       ...   print repr(attrnm), ',', repr(val)
       ...
-      'cc' , ''
+      '_ts' , '...'
+      'cc' , u''
+      'changetime' , datetime.datetime(..., tzinfo=<FixedOffset "UTC" 0:00:00>)
       'component' , u'component1'
       'description' , u'God bless the devs who test their Trac plugins using dutest'
-      'keywords' , ''
+      'keywords' , u''
       'milestone' , u'milestone1'
       'owner' , u'somebody'
       'priority' , u'major'
       'reporter' , u'murphy'
-      'resolution' , ''
+      'resolution' , u''
       'status' , u'new'
       'summary' , u'Test TracGViz plugin'
+      'time' , datetime.datetime(..., tzinfo=<FixedOffset "UTC" 0:00:00>)
       'type' , u'task'
-      'version' , ''
+      'version' , u''
       
       # ... hidden using default configuration ...
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['ticket']))
-      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', 'God bless the devs who test their Trac plugins using dutest']
+      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', '<p>\nGod bless the devs who test their Trac plugins using dutest<br />\n</p>\n']
+
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['ticket_details']))         # Milestone hidden
       
       # ... visible otherwise ;o)
       >>> env.config.set('timeline', 'ticket_show_details', 'true')
       >>> env.config.save()
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['ticket']))
-      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', 'God bless the devs who test their Trac plugins using dutest']
+      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', '<p>\nGod bless the devs who test their Trac plugins using dutest<br />\n</p>\n']
+
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['ticket_details']))         # Milestone visible
-      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>milestone</i> changed<br/>Wanna do it right away']
+      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1#comment:1', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>Milestone</i> changed<br/><p>\nWanna do it right away<br />\n</p>\n']
       
       # Remember this glorious moment, then go to sleep
       >>> from time import sleep
 
       >>> print_timeline_events(rpcobj.getEvents(timestamp, None, ['ticket']))
       >>> print_timeline_events(rpcobj.getEvents(timestamp, None, ['ticket_details']))
-      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1#comment:3', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>status</i>, <i>owner</i> changed<br/>I accept the challenge']
+      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1#comment:3', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>Status</i>, <i>Owner</i> changed<br/><p>\nI accept the challenge<br />\n</p>\n']
       
       >>> from trac.util.datefmt import _epoc
       >>> print_timeline_events(rpcobj.getEvents(_epoc, timestamp, ['ticket']))
-      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', 'God bless the devs who test their Trac plugins using dutest']
+      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', '<p>\nGod bless the devs who test their Trac plugins using dutest<br />\n</p>\n']
+
       >>> print_timeline_events(rpcobj.getEvents(_epoc, timestamp, ['ticket_details']))
-      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>milestone</i> changed<br/>Wanna do it right away']
+      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1#comment:1', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>Milestone</i> changed<br/><p>\nWanna do it right away<br />\n</p>\n']
       
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['ticket']))   # All events
-      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', 'God bless the devs who test their Trac plugins using dutest']
+      ['newticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (new)">#1</em> (Test TracGViz plugin) created', '<p>\nGod bless the devs who test their Trac plugins using dutest<br />\n</p>\n']
+
       >>> print_timeline_events(rpcobj.getEvents(None, None, ['ticket_details']))
-      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>milestone</i> changed<br/>Wanna do it right away']
-      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1#comment:3', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>status</i>, <i>owner</i> changed<br/>I accept the challenge']
+      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1#comment:1', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>Milestone</i> changed<br/><p>\nWanna do it right away<br />\n</p>\n']
+      ['editedticket', u'murphy', '...', ..., 'http://example.org/trac.cgi/ticket/1#comment:3', 'Ticket <em title="task: Test TracGViz plugin (edit)">#1</em> (Test TracGViz plugin) updated', '<i>Status</i>, <i>Owner</i> changed<br/><p>\nI accept the challenge<br />\n</p>\n']
       
       # Be nice. Reset default config.
       # Don't wanna know all the details. I'll rule the world anyway