github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/api/state_access_for_testing.go (about) 1 // Copyright 2012, 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package api 5 6 // The functions below break through the Connection abstraction to access or 7 // modify part of the underlying state. They need to be exported because they 8 // are used in tests for the client facade client. 9 10 // SetServerAddressForTesting allows changing the URL to the internal API server that 11 // AddLocalCharm uses in order to test NotImplementedError. Hopefully it will 12 // soon be gone forever. 13 func SetServerAddressForTesting(c Connection, scheme, addr string) { 14 c.(*state).serverScheme = scheme 15 c.(*state).addr = addr 16 } 17 18 // EmptyConnectionForTesting exists only to allow api/client/client.BarebonesClient() to 19 // be implemented. Hopefully it will soon be gone forever. 20 func EmptyConnectionForTesting() Connection { 21 return &state{} 22 }