@@ -698,71 +698,6 @@ func TestAppServiceAcquireTokenReturnsTokenSuccess(t *testing.T) {
698
698
}
699
699
}
700
700
701
- // TestAppServiceWithClientCapabilities tests the scenario when App Service includes client capabilities
702
- func TestAppServiceWithClientCapabilities (t * testing.T ) {
703
- setEnvVars (t , AppService )
704
-
705
- testCases := []struct {
706
- name string
707
- expectError bool
708
- expectedStatusCode int
709
- expectedToken string
710
- expectedCapabilities string
711
- capabilities []string
712
- }{
713
- {
714
- name : "Token Request with Client Capabilities" ,
715
- expectError : false ,
716
- expectedStatusCode : http .StatusOK ,
717
- expectedToken : token ,
718
- expectedCapabilities : "c1,c2" ,
719
- capabilities : []string {"c1" , "c2" },
720
- },
721
- }
722
-
723
- for _ , testCase := range testCases {
724
- t .Run (testCase .name , func (t * testing.T ) {
725
- mockClient := mock .NewClient ()
726
- localUrl := & url.URL {}
727
- responseBody , err := getSuccessfulResponse (resource , false )
728
- if err != nil {
729
- t .Fatalf (errorFormingJsonResponse , err .Error ())
730
- }
731
- mockClient .AppendResponse (mock .WithHTTPStatusCode (http .StatusOK ),
732
- mock .WithBody (responseBody ),
733
- mock .WithCallback (func (r * http.Request ) {
734
- localUrl = r .URL
735
- }))
736
- client , err := New (SystemAssigned (), WithHTTPClient (mockClient ), WithClientCapabilities (testCase .capabilities ))
737
- if err != nil {
738
- t .Fatal (err )
739
- }
740
-
741
- result , err := client .AcquireToken (context .Background (), resource )
742
- if testCase .expectError {
743
- if err == nil {
744
- t .Fatal ("Expected error but got nil" )
745
- }
746
- var callErr errors.CallErr
747
- if ! errors .As (err , & callErr ) {
748
- t .Fatalf ("Expected error of type CallErr, got %T" , err )
749
- }
750
- } else {
751
- if err != nil {
752
- t .Fatalf ("AcquireToken failed: %v" , err )
753
- }
754
- if result .AccessToken != testCase .expectedToken {
755
- t .Fatalf ("Expected access token %q, got %q" , testCase .expectedToken , result .AccessToken )
756
- }
757
- localUrlQuerry := localUrl .Query ()
758
- if localUrlQuerry .Get ("xms_cc" ) != testCase .expectedCapabilities {
759
- t .Fatalf ("Expected client capabilities %q, got %q" , testCase .expectedCapabilities , localUrlQuerry .Get ("xms_cc" ))
760
- }
761
- }
762
- })
763
- }
764
- }
765
-
766
701
func TestAzureMLAcquireTokenReturnsTokenSuccess (t * testing.T ) {
767
702
defaultClientID := "A"
768
703
t .Setenv ("DEFAULT_IDENTITY_CLIENT_ID" , defaultClientID )
0 commit comments