From 07a462b2cdaf27b0d40b5d216a9f7403327ae60b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 10 2015 13:30:15 +0000 Subject: Adjust the unit-tests for the change in the output returned by api_projects --- diff --git a/tests/test_progit_flask_api_project.py b/tests/test_progit_flask_api_project.py index daf571c..555f5bd 100644 --- a/tests/test_progit_flask_api_project.py +++ b/tests/test_progit_flask_api_project.py @@ -132,24 +132,80 @@ class PagureFlaskApiProjecttests(tests.Modeltests): output = self.app.get('/api/0/projects?tags=infra') self.assertEqual(output.status_code, 200) data = json.loads(output.data) + data['projects'][0]['date_created'] = "1436527638" self.assertDictEqual( data, - {'projects': ['https://pagure.org/test']} + { + "projects": [ + { + "date_created": "1436527638", + "description": "test project #1", + "id": 1, + "name": "test", + "parent": None, + "user": { + "fullname": "PY C", + "name": "pingou" + } + } + ] + } ) output = self.app.get('/api/0/projects?username=pingou') self.assertEqual(output.status_code, 200) data = json.loads(output.data) + data['projects'][0]['date_created'] = "1436527638" + data['projects'][1]['date_created'] = "1436527638" self.assertDictEqual( data, - {'projects': - ['https://pagure.org/test', 'https://pagure.org/test2']} + { + "projects": [ + { + "date_created": "1436527638", + "description": "test project #1", + "id": 1, + "name": "test", + "parent": None, + "user": { + "fullname": "PY C", + "name": "pingou" + } + }, + { + "date_created": "1436527638", + "description": "test project #2", + "id": 2, + "name": "test2", + "parent": None, + "user": { + "fullname": "PY C", + "name": "pingou" + } + } + ] + } ) output = self.app.get('/api/0/projects?username=pingou&tags=infra') self.assertEqual(output.status_code, 200) data = json.loads(output.data) + data['projects'][0]['date_created'] = "1436527638" self.assertDictEqual( data, - {'projects': ['https://pagure.org/test']} + { + "projects": [ + { + "date_created": "1436527638", + "description": "test project #1", + "id": 1, + "name": "test", + "parent": None, + "user": { + "fullname": "PY C", + "name": "pingou" + } + } + ] + } )