11import unittest
2+ import yaml
23from http import HTTPStatus
4+ from typing import Optional , List , Union
35
46from abstract_test_case import AbstractTestCase
57from cloudfoundry_client .common_objects import JsonObject
@@ -132,3 +134,29 @@ def test_list_include_space(self):
132134 self .assertIsInstance (all_spaces [0 ], Entity )
133135 self .assertEqual (all_spaces [1 ]["name" ], "my_space" )
134136 self .assertIsInstance (all_spaces [1 ], Entity )
137+
138+ def test_get_manifest (self ):
139+ self .client .get .return_value = self .mock_response (
140+ "/v3/apps/app_id/manifest" , HTTPStatus .OK , {"Content-Type" : "application/x-yaml" }, "v3" , "apps" ,
141+ "GET_{id}_manifest_response.yml"
142+ )
143+ manifest_response : str = self .client .v3 .apps .get_manifest ("app_id" )
144+ self .assertIsInstance (manifest_response , str )
145+ manifest : dict = yaml .safe_load (manifest_response )
146+ applications : Optional [list [dict ]] = manifest .get ("applications" )
147+ self .assertIsInstance (applications , list )
148+ self .assertEqual (len (applications ), 1 )
149+ application : dict = applications [0 ]
150+ self .assertEqual (application .get ("name" ), "my-app" )
151+ self .assertEqual (application .get ("stack" ), "cflinuxfs4" )
152+ application_services : Optional [list [str ]] = application .get ("services" )
153+ self .assertIsInstance (application_services , list )
154+ self .assertEqual (len (application_services ),1 )
155+ self .assertEqual (application_services [0 ],"my-service" )
156+ application_routes : Optional [List [Union [dict ,str ]]] = application .get ("routes" )
157+ self .assertIsInstance (application_routes ,list )
158+ self .assertEqual (len (application_routes ),1 )
159+ application_route : dict = application_routes [0 ]
160+ self .assertIsInstance (application_route ,dict )
161+ self .assertEqual (application_route .get ("route" ),"my-app.example.com" )
162+ self .assertEqual (application_route .get ("protocol" ),"http1" )
0 commit comments