Abhilash Raj has proposed merging lp:~raj-abhilash1/mailman/bugfix into 
lp:mailman.

Requested reviews:
  Mailman Coders (mailman-coders)

For more details, see:
https://code.launchpad.net/~raj-abhilash1/mailman/bugfix/+merge/256233

When creating domain with single owner passed via json, InvalidEmailError was 
raise. Fixed that.
-- 
Your team Mailman Coders is requested to review the proposed merge of 
lp:~raj-abhilash1/mailman/bugfix into lp:mailman.
=== modified file 'src/mailman/rest/domains.py'
--- src/mailman/rest/domains.py	2015-04-07 01:39:34 +0000
+++ src/mailman/rest/domains.py	2015-04-14 21:33:34 +0000
@@ -118,7 +118,10 @@
             # but .add() requires an `owners` keyword.  Match impedence.
             owners = values.pop('owner', None)
             if owners is not None:
-                values['owners'] = owners
+                if isinstance(owners, str):
+                    values['owners'] = [owners]
+                else:
+                    values['owners'] = owners
             domain = domain_manager.add(**values)
         except BadDomainSpecificationError as error:
             bad_request(response, str(error))

=== modified file 'src/mailman/rest/tests/test_domains.py'
--- src/mailman/rest/tests/test_domains.py	2015-04-07 02:06:28 +0000
+++ src/mailman/rest/tests/test_domains.py	2015-04-14 21:33:34 +0000
@@ -54,6 +54,14 @@
             'http://localhost:9001/3.0/domains', data, method="POST")
         self.assertEqual(response.status, 201)
 
+    def test_domain_create_with_single_owner(self):
+        # Creating domain with single owner should not raise InvalidEmailError
+        content, response = call_api('http://localhost:9001/3.0/domains',
+                                     dict(mail_host='example.in',
+                                          owner='[email protected]'),
+                                     method='POST')
+        self.assertEqual(response.status, 201)
+
     def test_bogus_endpoint_extension(self):
         # /domains/<domain>/lists/<anything> is not a valid endpoint.
         with self.assertRaises(HTTPError) as cm:
@@ -102,6 +110,7 @@
         self.assertEqual(cm.exception.code, 404)
 
 
+
 
 class TestDomainOwners(unittest.TestCase):
     layer = RESTLayer

_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders

Reply via email to