------------------------------------------------------------
revno: 6752
committer: Barry Warsaw <[email protected]>
branch nick: 3.0
timestamp: Tue 2009-07-21 07:07:58 -0400
message:
  Expose 'transaction' as an alias for config.db in the doctest globs.  This
  means commit() is now transaction.commit() in doctests.
  
  Add tests of extended domain creation, which exposes the need to unlock the
  database (via transaction.abort()) so that the foreground test process doesn't
  lock the background REST server process.
modified:
  src/mailman/queue/docs/archiver.txt
  src/mailman/queue/docs/lmtp.txt
  src/mailman/queue/docs/outgoing.txt
  src/mailman/rest/docs/domains.txt
  src/mailman/rest/webservice.py
  src/mailman/tests/test_documentation.py

=== modified file 'src/mailman/queue/docs/archiver.txt'
--- src/mailman/queue/docs/archiver.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/queue/docs/archiver.txt 2009-07-21 11:07:58 +0000
@@ -7,7 +7,7 @@
 
     >>> from mailman.app.lifecycle import create_list
     >>> mlist = create_list('[email protected]')
-    >>> commit()
+    >>> transaction.commit()
 
     >>> msg = message_from_string("""\
     ... From: [email protected]

=== modified file 'src/mailman/queue/docs/lmtp.txt'
--- src/mailman/queue/docs/lmtp.txt     2009-07-19 02:31:45 +0000
+++ src/mailman/queue/docs/lmtp.txt     2009-07-21 11:07:58 +0000
@@ -48,7 +48,8 @@
     >>> from mailman.app.lifecycle import create_list
     >>> create_list('[email protected]')
     <mailing list "[email protected]" at ...>
-    >>> commit()
+
+    >>> transaction.commit()
     >>> lmtp.sendmail(
     ...     '[email protected]',
     ...     ['[email protected]'], """\

=== modified file 'src/mailman/queue/docs/outgoing.txt'
--- src/mailman/queue/docs/outgoing.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/queue/docs/outgoing.txt 2009-07-21 11:07:58 +0000
@@ -28,7 +28,7 @@
 
     >>> from mailman.interfaces.mailinglist import Personalization
     >>> mlist.personalize = Personalization.individual
-    >>> commit()
+    >>> transaction.commit()
 
     >>> msg = message_from_string("""\
     ... From: [email protected]

=== modified file 'src/mailman/rest/docs/domains.txt'
--- src/mailman/rest/docs/domains.txt   2009-07-21 03:13:59 +0000
+++ src/mailman/rest/docs/domains.txt   2009-07-21 11:07:58 +0000
@@ -8,7 +8,7 @@
     >>> manager = IDomainManager(config)
     >>> manager.remove('example.com')
     <Domain example.com...>
-    >>> commit()
+    >>> transaction.commit()
 
 The REST API can be queried for the set of known domains, of which there are
 initially none.
@@ -25,7 +25,7 @@
     <Domain example.com, An example domain,
             base_url: http://lists.example.com,
             contact_address: [email protected]>
-    >>> commit()
+    >>> transaction.commit()
 
     >>> dump_json('http://localhost:8001/3.0/domains')
     entry 0:
@@ -55,7 +55,7 @@
     <Domain lists.example.net, Porkmasters,
             base_url: http://example.net,
             contact_address: [email protected]>
-    >>> commit()
+    >>> transaction.commit()
 
     >>> dump_json('http://localhost:8001/3.0/domains')
     entry 0:
@@ -141,7 +141,7 @@
     contact_address: [email protected]
     description: None
     email_host: lists.example.com
-    http_etag: "349365fdbf946e64fc1052b936b9192eaa94b850"
+    http_etag: "..."
     resource_type_link: http://localhost:8001/3.0/#domain
     self_link: http://localhost:8001/3.0/domains/lists.example.com
     url_host: lists.example.com
@@ -152,3 +152,43 @@
     <Domain lists.example.com,
             base_url: http://lists.example.com,
             contact_address: [email protected]>
+
+    # Unlock the database.
+    >>> transaction.abort()
+
+You can also create a new domain with a description, a base url, and a contact
+address.
+
+    >>> dump_json('http://localhost:8001/3.0/domains', {
+    ...           'ws.op': 'new',
+    ...           'email_host': 'my.example.com',
+    ...           'description': 'My new domain',
+    ...           'base_url': 'http://allmy.example.com',
+    ...           'contact_address': '[email protected]'
+    ...           })
+    URL: http://localhost:8001/3.0/domains
+    content-length: 0
+    content-type: text/plain
+    date: ...
+    location: http://localhost:8001/3.0/domains/my.example.com
+    server: WSGIServer/... Python/...
+    x-content-type-warning: guessed from content
+    x-powered-by: Zope (www.zope.org), Python (www.python.org)
+
+    >>> dump_json('http://localhost:8001/3.0/domains/my.example.com')
+    base_url: http://allmy.example.com
+    contact_address: [email protected]
+    description: My new domain
+    email_host: my.example.com
+    http_etag: "..."
+    resource_type_link: http://localhost:8001/3.0/#domain
+    self_link: http://localhost:8001/3.0/domains/my.example.com
+    url_host: allmy.example.com
+
+    >>> manager['my.example.com']
+    <Domain my.example.com, My new domain,
+            base_url: http://allmy.example.com,
+            contact_address: [email protected]>
+
+    # Unlock the database.
+    >>> transaction.abort()

=== modified file 'src/mailman/rest/webservice.py'
--- src/mailman/rest/webservice.py      2009-07-17 02:36:06 +0000
+++ src/mailman/rest/webservice.py      2009-07-21 11:07:58 +0000
@@ -49,7 +49,7 @@
 
 
 
-# pylint: disable-msg: W0232
+# pylint: disable-msg=W0232
 class AdminWebServiceRequest(WebServiceRequestTraversal, BrowserRequest):
     """A request for the admin REST interface."""
 

=== modified file 'src/mailman/tests/test_documentation.py'
--- src/mailman/tests/test_documentation.py     2009-07-21 03:13:59 +0000
+++ src/mailman/tests/test_documentation.py     2009-07-21 11:07:58 +0000
@@ -156,7 +156,6 @@
     # doctests should do the imports themselves.  It makes for better
     # documentation that way.  However, a few are really useful, or help to
     # hide some icky test implementation details.
-    testobj.globs['commit'] = config.db.commit
     testobj.globs['config'] = config
     testobj.globs['create_list'] = create_list
     testobj.globs['dump_json'] = dump_json
@@ -164,6 +163,7 @@
     testobj.globs['message_from_string'] = specialized_message_from_string
     testobj.globs['smtpd'] = SMTPLayer.smtpd
     testobj.globs['stop'] = stop
+    testobj.globs['transaction'] = config.db
 
 
 



--
lp:mailman
https://code.launchpad.net/~mailman-coders/mailman/3.0

Your team Mailman Checkins is subscribed to branch lp:mailman.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/3.0/+edit-subscription.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to