@@ -556,6 +556,36 @@ def resp_get_project(url, request):
556556 self .assertEqual (data .name , "name" )
557557 self .assertEqual (data .id , 1 )
558558
559+ def test_project_environments (self ):
560+ @urlmatch (
561+ scheme = "http" , netloc = "localhost" , path = "/api/v4/projects/1$" , method = "get"
562+ )
563+ def resp_get_project (url , request ):
564+ headers = {"content-type" : "application/json" }
565+ content = '{"name": "name", "id": 1}' .encode ("utf-8" )
566+ return response (200 , content , headers , None , 5 , request )
567+
568+ @urlmatch (
569+ scheme = "http" ,
570+ netloc = "localhost" ,
571+ path = "/api/v4/projects/1/environments/1" ,
572+ method = "get" ,
573+ )
574+ def resp_get_environment (url , request ):
575+ headers = {"content-type" : "application/json" }
576+ content = '{"name": "environment_name", "id": 1, "last_deployment": "sometime"}' .encode (
577+ "utf-8"
578+ )
579+ return response (200 , content , headers , None , 5 , request )
580+
581+ with HTTMock (resp_get_project , resp_get_environment ):
582+ project = self .gl .projects .get (1 )
583+ environment = project .environments .get (1 )
584+ self .assertIsInstance (environment , ProjectEnvironment )
585+ self .assertEqual (environment .id , 1 )
586+ self .assertEqual (environment .last_deployment , "sometime" )
587+ self .assertEqual (environment .name , "environment_name" )
588+
559589 def test_groups (self ):
560590 @urlmatch (
561591 scheme = "http" , netloc = "localhost" , path = "/api/v4/groups/1" , method = "get"
0 commit comments