From 7b4f84dec792da854603d5a2ac0c1a75e6b58351 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 02 2015 09:09:17 +0000 Subject: Adjust the unit-tests to test accessing an issue via it's uid --- diff --git a/tests/test_progit_flask_api_issue.py b/tests/test_progit_flask_api_issue.py index 81347e4..0aec6db 100644 --- a/tests/test_progit_flask_api_issue.py +++ b/tests/test_progit_flask_api_issue.py @@ -433,6 +433,7 @@ class PagureFlaskApiIssuetests(tests.Modeltests): user='pingou', ticketfolder=None, private=True, + issue_uid='aaabbbccc', ) self.session.commit() self.assertEqual(msg.title, 'Test issue') @@ -515,6 +516,32 @@ class PagureFlaskApiIssuetests(tests.Modeltests): } ) + # Access private issue authenticated correctly using the issue's uid + output = self.app.get('/api/0/test/issue/aaabbbccc', headers=headers) + self.assertEqual(output.status_code, 200) + data = json.loads(output.data) + data['date_created'] = '1431414800' + self.assertDictEqual( + data, + { + "assignee": None, + "blocks": [], + "comments": [], + "content": "We should work on this", + "date_created": "1431414800", + "depends": [], + "id": 2, + "private": True, + "status": "Open", + "tags": [], + "title": "Test issue", + "user": { + "fullname": "PY C", + "name": "pingou" + } + } + ) + def test_api_change_status_issue(self): """ Test the api_change_status_issue method of the flask api. """ tests.create_projects(self.session)