| 
									
										
										
										
											2019-05-08 00:55:39 +08:00
										 |  |  | package pluginproxy | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"testing" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-17 18:31:35 +08:00
										 |  |  | 	"github.com/stretchr/testify/assert" | 
					
						
							|  |  |  | 	"github.com/stretchr/testify/require" | 
					
						
							| 
									
										
										
										
											2019-05-08 00:55:39 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestInterpolateString(t *testing.T) { | 
					
						
							| 
									
										
										
										
											2020-11-17 18:31:35 +08:00
										 |  |  | 	data := templateData{ | 
					
						
							|  |  |  | 		SecureJsonData: map[string]string{ | 
					
						
							|  |  |  | 			"Test": "0asd+asd", | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-05-08 00:55:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-17 18:31:35 +08:00
										 |  |  | 	interpolated, err := interpolateString("{{.SecureJsonData.Test}}", data) | 
					
						
							|  |  |  | 	require.NoError(t, err) | 
					
						
							|  |  |  | 	assert.Equal(t, "0asd+asd", interpolated) | 
					
						
							| 
									
										
										
										
											2019-05-08 00:55:39 +08:00
										 |  |  | } |