Hi List,

The API server client tests have a new suite, serverSuite, which allow you to test the api server methods without having to go through the api client.

This is how to use it:

// old way

func (s *clientSuite) TestSomething(c *gc.C) {
...
// calls via api/client
err := s.APIState.Client().EnvironmentSet(args)
...
}

// new way

func (s *serverSuite) TestSomething(c *gc.C) {
...
// does not touch api/client
err := s.client.EnvironmentSet(args)
...
}

I also added PatchClientFacadeCall to api/export_test.go which allows client side testing without touching the API server: https://github.com/juju/juju/blob/master/api/export_test.go (see TestShareEnvironmentExistingUser for an example)

Andrew just landed PatchFacadeCaller: https://github.com/juju/juju/blob/master/api/base/testing/patch.go. <https://github.com/juju/juju/blob/master/api/base/testing/patch.go> Which is a generic Facade patcher that requires setup in export_test.go to get access to the private facade instance (see provisioner tests for an example). PatchClientFacadeCall can be used now, but I will be refactoring it soon to leverage PatchFacadeCaller so we have a consistent approach across the codebase.

Cheers,
Jess
<https://github.com/juju/juju/blob/master/api/base/testing/patch.go>
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to