Barry Warsaw pushed to branch coverage at mailman / Mailman Core
Commits:
f9cfbb32 by Barry Warsaw at 2017-07-24T14:44:41-04:00
Boost coverage.
- - - - -
1 changed file:
- src/mailman/rest/tests/test_header_matches.py
Changes:
=
src/mailman/rest/tests/test_header_matches.py
=
--- a/src/mailman/rest/tests/test_header_matches.py
+++ b/src/mailman/rest/tests/test_header_matches.py
@@ -51,6 +51,17 @@ class TestHeaderMatches(unittest.TestCase):
self.assertEqual(cm.exception.reason,
'No header match at this position: 0')
+def test_patch_put_missing_header_match(self):
+with self.assertRaises(HTTPError) as cm:
+call_api('http://localhost:9001/3.0/lists/ant.example.com'
+ '/header-matches/0', dict(
+ header='From',
+ ),
+ method='PATCH')
+self.assertEqual(cm.exception.code, 404)
+self.assertEqual(cm.exception.reason,
+ 'No header match at this position: 0')
+
def test_add_duplicate(self):
header_matches = IHeaderMatchList(self._mlist)
with transaction():
@@ -70,3 +81,30 @@ class TestHeaderMatches(unittest.TestCase):
call_api('http://localhost:9001/3.0/lists/bee.example.com'
'/header-matches/')
self.assertEqual(cm.exception.code, 404)
+
+def test_header_match_post_bad_action(self):
+header_matches = IHeaderMatchList(self._mlist)
+with transaction():
+header_matches.append('header', 'pattern')
+with self.assertRaises(HTTPError) as cm:
+call_api('http://localhost:9001/3.0/lists/ant.example.com'
+ '/header-matches', {
+ 'action': 'donothing',
+})
+self.assertEqual(cm.exception.code, 400)
+self.assertEqual(cm.exception.reason,
+ 'Cannot convert parameters: action')
+
+def test_header_match_patch_bad_action(self):
+header_matches = IHeaderMatchList(self._mlist)
+with transaction():
+header_matches.append('header', 'pattern')
+with self.assertRaises(HTTPError) as cm:
+call_api('http://localhost:9001/3.0/lists/ant.example.com'
+ '/header-matches/0', {
+ 'action': 'donothing',
+},
+ method='PATCH')
+self.assertEqual(cm.exception.code, 400)
+self.assertEqual(cm.exception.reason,
+ 'Cannot convert parameters: action')
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/f9cfbb32144d328aa5a662fb192153616f0cbbf7
---
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/f9cfbb32144d328aa5a662fb192153616f0cbbf7
You're receiving this email because of your account on gitlab.com.
___
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org