Documentation ¶
Index ¶
- func AreaPageRender(rend RenderClient, cli CodeListClient, dcli DatasetClient, ...) http.HandlerFunc
- func HomepageRender(rend RenderClient, cli CodeListClient) http.HandlerFunc
- func ListPageRender(rend RenderClient, cli CodeListClient) http.HandlerFunc
- type ClientError
- type CodeListClient
- type CodeListClientMock
- func (mock *CodeListClientMock) GetCodeByID(ctx context.Context, userAuthToken string, serviceAuthToken string, ...) (codelist.CodeResult, error)
- func (mock *CodeListClientMock) GetCodeByIDCalls() []struct{ ... }
- func (mock *CodeListClientMock) GetCodeListEditions(ctx context.Context, userAuthToken string, serviceAuthToken string, ...) (codelist.EditionsListResults, error)
- func (mock *CodeListClientMock) GetCodeListEditionsCalls() []struct{ ... }
- func (mock *CodeListClientMock) GetCodes(ctx context.Context, userAuthToken string, serviceAuthToken string, ...) (codelist.CodesResults, error)
- func (mock *CodeListClientMock) GetCodesCalls() []struct{ ... }
- func (mock *CodeListClientMock) GetDatasetsByCode(ctx context.Context, userAuthToken string, serviceAuthToken string, ...) (codelist.DatasetsResult, error)
- func (mock *CodeListClientMock) GetDatasetsByCodeCalls() []struct{ ... }
- func (mock *CodeListClientMock) GetGeographyCodeLists(ctx context.Context, userAuthToken string, serviceAuthToken string) (codelist.CodeListResults, error)
- func (mock *CodeListClientMock) GetGeographyCodeListsCalls() []struct{ ... }
- type DatasetClient
- type DatasetClientMock
- type RenderClient
- type RenderClientMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreaPageRender ¶
func AreaPageRender(rend RenderClient, cli CodeListClient, dcli DatasetClient, apiRouterVersion string) http.HandlerFunc
AreaPageRender gets data about a specific code, get what datasets are associated with the code and get information about those datasets, maps it and passes it to the renderer
func HomepageRender ¶
func HomepageRender(rend RenderClient, cli CodeListClient) http.HandlerFunc
HomepageRender gets geography data from the code-list-api and formats for rendering
func ListPageRender ¶
func ListPageRender(rend RenderClient, cli CodeListClient) http.HandlerFunc
ListPageRender renders a list of codes associated to the first edition of a code-list
Types ¶
type ClientError ¶
ClientError is an interface that can be used to retrieve the status code if a client has errored
type CodeListClient ¶
type CodeListClient interface { GetGeographyCodeLists(ctx context.Context, userAuthToken string, serviceAuthToken string) (editions codelist.CodeListResults, err error) GetCodeListEditions(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string) (editions codelist.EditionsListResults, err error) GetCodes(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string) (codes codelist.CodesResults, err error) GetCodeByID(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (code codelist.CodeResult, err error) GetDatasetsByCode(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (datasets codelist.DatasetsResult, err error) }
CodeListClient is an interface with methods required for a code-list client
type CodeListClientMock ¶
type CodeListClientMock struct { // GetCodeByIDFunc mocks the GetCodeByID method. GetCodeByIDFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (codelist.CodeResult, error) // GetCodeListEditionsFunc mocks the GetCodeListEditions method. GetCodeListEditionsFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string) (codelist.EditionsListResults, error) // GetCodesFunc mocks the GetCodes method. GetCodesFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string) (codelist.CodesResults, error) // GetDatasetsByCodeFunc mocks the GetDatasetsByCode method. GetDatasetsByCodeFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (codelist.DatasetsResult, error) // GetGeographyCodeListsFunc mocks the GetGeographyCodeLists method. GetGeographyCodeListsFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string) (codelist.CodeListResults, error) // contains filtered or unexported fields }
CodeListClientMock is a mock implementation of CodeListClient.
func TestSomethingThatUsesCodeListClient(t *testing.T) { // make and configure a mocked CodeListClient mockedCodeListClient := &CodeListClientMock{ GetCodeByIDFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (codelist.CodeResult, error) { panic("mock out the GetCodeByID method") }, GetCodeListEditionsFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string) (codelist.EditionsListResults, error) { panic("mock out the GetCodeListEditions method") }, GetCodesFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string) (codelist.CodesResults, error) { panic("mock out the GetCodes method") }, GetDatasetsByCodeFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (codelist.DatasetsResult, error) { panic("mock out the GetDatasetsByCode method") }, GetGeographyCodeListsFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string) (codelist.CodeListResults, error) { panic("mock out the GetGeographyCodeLists method") }, } // use mockedCodeListClient in code that requires CodeListClient // and then make assertions. }
func (*CodeListClientMock) GetCodeByID ¶
func (mock *CodeListClientMock) GetCodeByID(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (codelist.CodeResult, error)
GetCodeByID calls GetCodeByIDFunc.
func (*CodeListClientMock) GetCodeByIDCalls ¶
func (mock *CodeListClientMock) GetCodeByIDCalls() []struct { Ctx context.Context UserAuthToken string ServiceAuthToken string CodeListID string Edition string CodeID string }
GetCodeByIDCalls gets all the calls that were made to GetCodeByID. Check the length with:
len(mockedCodeListClient.GetCodeByIDCalls())
func (*CodeListClientMock) GetCodeListEditions ¶
func (mock *CodeListClientMock) GetCodeListEditions(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string) (codelist.EditionsListResults, error)
GetCodeListEditions calls GetCodeListEditionsFunc.
func (*CodeListClientMock) GetCodeListEditionsCalls ¶
func (mock *CodeListClientMock) GetCodeListEditionsCalls() []struct { Ctx context.Context UserAuthToken string ServiceAuthToken string CodeListID string }
GetCodeListEditionsCalls gets all the calls that were made to GetCodeListEditions. Check the length with:
len(mockedCodeListClient.GetCodeListEditionsCalls())
func (*CodeListClientMock) GetCodes ¶
func (mock *CodeListClientMock) GetCodes(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string) (codelist.CodesResults, error)
GetCodes calls GetCodesFunc.
func (*CodeListClientMock) GetCodesCalls ¶
func (mock *CodeListClientMock) GetCodesCalls() []struct { Ctx context.Context UserAuthToken string ServiceAuthToken string CodeListID string Edition string }
GetCodesCalls gets all the calls that were made to GetCodes. Check the length with:
len(mockedCodeListClient.GetCodesCalls())
func (*CodeListClientMock) GetDatasetsByCode ¶
func (mock *CodeListClientMock) GetDatasetsByCode(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (codelist.DatasetsResult, error)
GetDatasetsByCode calls GetDatasetsByCodeFunc.
func (*CodeListClientMock) GetDatasetsByCodeCalls ¶
func (mock *CodeListClientMock) GetDatasetsByCodeCalls() []struct { Ctx context.Context UserAuthToken string ServiceAuthToken string CodeListID string Edition string CodeID string }
GetDatasetsByCodeCalls gets all the calls that were made to GetDatasetsByCode. Check the length with:
len(mockedCodeListClient.GetDatasetsByCodeCalls())
func (*CodeListClientMock) GetGeographyCodeLists ¶
func (mock *CodeListClientMock) GetGeographyCodeLists(ctx context.Context, userAuthToken string, serviceAuthToken string) (codelist.CodeListResults, error)
GetGeographyCodeLists calls GetGeographyCodeListsFunc.
func (*CodeListClientMock) GetGeographyCodeListsCalls ¶
func (mock *CodeListClientMock) GetGeographyCodeListsCalls() []struct { Ctx context.Context UserAuthToken string ServiceAuthToken string }
GetGeographyCodeListsCalls gets all the calls that were made to GetGeographyCodeLists. Check the length with:
len(mockedCodeListClient.GetGeographyCodeListsCalls())
type DatasetClient ¶
type DatasetClient interface {
Get(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, datasetID string) (m dataset.DatasetDetails, err error)
}
DatasetClient is an interface with methods required for a dataset client
type DatasetClientMock ¶
type DatasetClientMock struct { // GetFunc mocks the Get method. GetFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string) (dataset.DatasetDetails, error) // contains filtered or unexported fields }
DatasetClientMock is a mock implementation of DatasetClient.
func TestSomethingThatUsesDatasetClient(t *testing.T) { // make and configure a mocked DatasetClient mockedDatasetClient := &DatasetClientMock{ GetFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string) (dataset.DatasetDetails, error) { panic("mock out the Get method") }, } // use mockedDatasetClient in code that requires DatasetClient // and then make assertions. }
func (*DatasetClientMock) Get ¶
func (mock *DatasetClientMock) Get(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string) (dataset.DatasetDetails, error)
Get calls GetFunc.
func (*DatasetClientMock) GetCalls ¶
func (mock *DatasetClientMock) GetCalls() []struct { Ctx context.Context UserAuthToken string ServiceAuthToken string CollectionID string DatasetID string }
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedDatasetClient.GetCalls())
type RenderClient ¶
RenderClient is an interface with methods for require for rendering a template
type RenderClientMock ¶
type RenderClientMock struct { // DoFunc mocks the Do method. DoFunc func(in1 string, in2 []byte) ([]byte, error) // contains filtered or unexported fields }
RenderClientMock is a mock implementation of RenderClient.
func TestSomethingThatUsesRenderClient(t *testing.T) { // make and configure a mocked RenderClient mockedRenderClient := &RenderClientMock{ DoFunc: func(in1 string, in2 []byte) ([]byte, error) { panic("mock out the Do method") }, } // use mockedRenderClient in code that requires RenderClient // and then make assertions. }
func (*RenderClientMock) Do ¶
func (mock *RenderClientMock) Do(in1 string, in2 []byte) ([]byte, error)
Do calls DoFunc.
func (*RenderClientMock) DoCalls ¶
func (mock *RenderClientMock) DoCalls() []struct { In1 string In2 []byte }
DoCalls gets all the calls that were made to Do. Check the length with:
len(mockedRenderClient.DoCalls())