Skip to content

Examples should have tests as well #9

@staceytay

Description

@staceytay

Would like example/echo/service/service.go to have sample tests that shows examples on how to test an Orion service, for both gRPC and http requests.

The context for this is that I'm attempting to write tests for https://github.com/carousell/SSO and so would like to refer to effective and efficient ways to test the service. For example, how to create a test an Orion service with the database functions mocked.

I tried creating a sample service

	service := &ssoServiceImpl{
		true,
		&djangoService{},
		"i63t3cfyumyMY2mY2DLM3HJQKYvGu24H",
		securecookie.New([]byte("i63t3cfyumyMY2mY2DLM3HJQKYvGu24H"), []byte("v6D83W7i6CJc7suVQzEEQPbu6mdNsrW6")),
		&storageClient{},
	}

	req := new(proto.LoginRequest)
	service.Login(ctx, req)

but this doesn't allow me to test for the http response codes and headers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions