Add unit test for protected resources
This commit is contained in:
		
							parent
							
								
									8cbf9219bc
								
							
						
					
					
						commit
						017b9bcfb7
					
				|  | @ -47,3 +47,21 @@ func TestAcrValuesConfigured(t *testing.T) { | ||||||
| 	result := p.GetLoginURL("https://my.test.app/oauth", "") | 	result := p.GetLoginURL("https://my.test.app/oauth", "") | ||||||
| 	assert.Contains(t, result, "acr_values=testValue") | 	assert.Contains(t, result, "acr_values=testValue") | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func TestProtectedResourceConfigured(t *testing.T) { | ||||||
|  | 	p := &ProviderData{ | ||||||
|  | 		LoginURL: &url.URL{ | ||||||
|  | 			Scheme: "http", | ||||||
|  | 			Host:   "my.test.idp", | ||||||
|  | 			Path:   "/oauth/authorize", | ||||||
|  | 		}, | ||||||
|  | 		AcrValues: "testValue", | ||||||
|  | 		ProtectedResource: &url.URL{ | ||||||
|  | 			Scheme: "http", | ||||||
|  | 			Host:   "my.resource.test", | ||||||
|  | 		}, | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	result := p.GetLoginURL("https://my.test.app/oauth", "") | ||||||
|  | 	assert.Contains(t, result, "resource="+url.QueryEscape("http://my.resource.test")) | ||||||
|  | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue