github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/libkb/client_test.go (about)

     1  package libkb
     2  
     3  import (
     4  	"github.com/stretchr/testify/require"
     5  	"testing"
     6  )
     7  
     8  func TestServerLookup(t *testing.T) {
     9  	server, err := ServerLookup(NewEnv(nil, nil, makeLogGetter(t)), DevelRunMode)
    10  	require.Equal(t, DevelServerURI, server)
    11  	require.Equal(t, nil, err)
    12  
    13  	server, err = ServerLookup(NewEnv(nil, nil, makeLogGetter(t)), StagingRunMode)
    14  	require.Equal(t, StagingServerURI, server)
    15  	require.Equal(t, nil, err)
    16  
    17  	server, err = ServerLookup(NewEnv(nil, nil, makeLogGetter(t)), StagingRunMode)
    18  	require.Equal(t, StagingServerURI, server)
    19  	require.Equal(t, nil, err)
    20  
    21  	server, err = ServerLookup(NewEnv(MockedConfig{NullConfiguration{}, true}, nil, makeLogGetter(t)), ProductionRunMode)
    22  	require.Equal(t, ProductionServerURI, server)
    23  	require.Equal(t, nil, err)
    24  
    25  	server, err = ServerLookup(NewEnv(MockedConfig{NullConfiguration{}, false}, nil, makeLogGetter(t)), ProductionRunMode)
    26  	require.Equal(t, ProductionSiteURI, server)
    27  	require.Equal(t, nil, err)
    28  
    29  	server, err = ServerLookup(NewEnv(MockedConfig{NullConfiguration{}, false}, nil, makeLogGetter(t)), NoRunMode)
    30  	require.Equal(t, "", server)
    31  	require.NotEqual(t, nil, err)
    32  }