mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			627 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			627 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package http
 | |
| 
 | |
| import (
 | |
| 	"net/http"
 | |
| 	"reflect"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/hashicorp/vault/vault"
 | |
| )
 | |
| 
 | |
| func TestSysLeader_get(t *testing.T) {
 | |
| 	core, _, _ := vault.TestCoreUnsealed(t)
 | |
| 	ln, addr := TestServer(t, core)
 | |
| 	defer ln.Close()
 | |
| 
 | |
| 	resp, err := http.Get(addr + "/v1/sys/leader")
 | |
| 	if err != nil {
 | |
| 		t.Fatalf("err: %s", err)
 | |
| 	}
 | |
| 
 | |
| 	var actual map[string]interface{}
 | |
| 	expected := map[string]interface{}{
 | |
| 		"ha_enabled":     false,
 | |
| 		"is_self":        false,
 | |
| 		"leader_address": "",
 | |
| 	}
 | |
| 	testResponseStatus(t, resp, 200)
 | |
| 	testResponseBody(t, resp, &actual)
 | |
| 	if !reflect.DeepEqual(actual, expected) {
 | |
| 		t.Fatalf("bad: %#v", actual)
 | |
| 	}
 | |
| }
 | 
