diff options
Diffstat (limited to 'src/mailman_pgp/rest/tests/test_lists.py')
| -rw-r--r-- | src/mailman_pgp/rest/tests/test_lists.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mailman_pgp/rest/tests/test_lists.py b/src/mailman_pgp/rest/tests/test_lists.py index f5f8754..e940517 100644 --- a/src/mailman_pgp/rest/tests/test_lists.py +++ b/src/mailman_pgp/rest/tests/test_lists.py @@ -14,7 +14,6 @@ # # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/>. -from time import sleep from unittest import TestCase from urllib.error import HTTPError @@ -23,6 +22,7 @@ from mailman.testing.helpers import call_api from pgpy import PGPKey from mailman_pgp.database import mm_transaction +from mailman_pgp.model.list import PGPMailingList from mailman_pgp.testing.layers import PGPRESTLayer @@ -56,14 +56,15 @@ class TestLists(TestCase): self.assertEqual(json['list_id'], self.mlist.list_id) def test_get_list_key(self): - for i in range(15): - try: - json, response = call_api( - 'http://localhost:9001/3.1/plugins/pgp/lists/' - 'test.example.com/key') - break - except HTTPError: - sleep(1) + with mm_transaction(): + mlist = create_list('another@example.com', + style_name='pgp-default') + pgp_list = PGPMailingList.for_list(mlist) + pgp_list.generate_key(True) + + json, response = call_api( + 'http://localhost:9001/3.1/plugins/pgp/lists/' + 'test.example.com/key') json.pop('http_etag') self.assertEqual(len(json.keys()), 2) |
