@@ -477,6 +477,44 @@ public function shouldDeleteImpersonationTokenForUser()
477477 $ this ->assertEquals ($ expectedBool , $ api ->removeImpersonationToken (1 , 1 ));
478478 }
479479
480+ /**
481+ * @test
482+ */
483+ public function shouldGetCurrentUserActiveImpersonationTokens ()
484+ {
485+ $ expectedArray = array (
486+ array ('id ' => 1 , 'name ' => 'A Name ' , 'revoked ' => true ),
487+ );
488+
489+ $ api = $ this ->getApiMock ();
490+ $ api ->expects ($ this ->once ())
491+ ->method ('get ' )
492+ ->with ('users/1/impersonation_tokens ' )
493+ ->will ($ this ->returnValue ($ expectedArray ))
494+ ;
495+
496+ $ this ->assertEquals ($ expectedArray , $ api ->userImpersonationTokens (1 , ['state ' => 'active ' ]));
497+ }
498+
499+ /**
500+ * @test
501+ */
502+ public function shouldGetCurrentUserInactiveImpersonationTokens ()
503+ {
504+ $ expectedArray = array (
505+ array ('id ' => 2 , 'name ' => 'A Name ' , 'revoked ' => false ),
506+ );
507+
508+ $ api = $ this ->getApiMock ();
509+ $ api ->expects ($ this ->once ())
510+ ->method ('get ' )
511+ ->with ('users/1/impersonation_tokens ' )
512+ ->will ($ this ->returnValue ($ expectedArray ))
513+ ;
514+
515+ $ this ->assertEquals ($ expectedArray , $ api ->userImpersonationTokens (1 , ['state ' => 'inactive ' ]));
516+ }
517+
480518 protected function getApiClass ()
481519 {
482520 return 'Gitlab\Api\Users ' ;
0 commit comments