-
- Downloads
Created generate scripts for basic functions and tests
Using Tenant as an example: The API types like Tenant, now go to `tenancy_tenants_types.go`. This file ends with two `go:generate` lines. One creates `tenancy_tenants.go` with the service and the functions like Get, List, Create... The second one creates basic tests in `tenant_tenants_basic_test.go`. As a result, `tenancy_tenants.go` and `tenancy_tenants_basic_test.go` should not be edited by hand. They will be overriden with the next `go generate`. Everything belonging to the type should go into `tenancy_tenants_types.go` (For example MarshalJSON.) All further tests, no matter if it targets the type (Tenant) or service (TenantsService), should go to `tenancy_tenants_test.go`. In this commit, both (`tenancy_tenant-groups_types.go` and `tenancy_tenants_type.go`) use `go:generate` to create functions and basic tests. But this is not a must, if it makes sense to implement endpoints by hand, this is totally fine.
Showing
- netbox/client.go 4 additions, 0 deletionsnetbox/client.go
- netbox/client_test.go 52 additions, 0 deletionsnetbox/client_test.go
- netbox/generate_basic_tests.go 383 additions, 0 deletionsnetbox/generate_basic_tests.go
- netbox/generate_functions.go 203 additions, 0 deletionsnetbox/generate_functions.go
- netbox/tenancy.go 35 additions, 0 deletionsnetbox/tenancy.go
- netbox/tenancy_tenant-groups.go 119 additions, 0 deletionsnetbox/tenancy_tenant-groups.go
- netbox/tenancy_tenant-groups_basic_test.go 301 additions, 0 deletionsnetbox/tenancy_tenant-groups_basic_test.go
- netbox/tenancy_tenant-groups_test.go 83 additions, 0 deletionsnetbox/tenancy_tenant-groups_test.go
- netbox/tenancy_tenant-groups_types.go 25 additions, 0 deletionsnetbox/tenancy_tenant-groups_types.go
- netbox/tenancy_tenants.go 119 additions, 0 deletionsnetbox/tenancy_tenants.go
- netbox/tenancy_tenants_basic_test.go 301 additions, 0 deletionsnetbox/tenancy_tenants_basic_test.go
- netbox/tenancy_tenants_test.go 194 additions, 0 deletionsnetbox/tenancy_tenants_test.go
- netbox/tenancy_tenants_types.go 103 additions, 0 deletionsnetbox/tenancy_tenants_types.go
Loading
Please register or sign in to comment