MCPcopy Index your code
hub / github.com/coder/coder / configureMockDeployment

Function configureMockDeployment

enterprise/coderd/usage/publisher_test.go:661–680  ·  view source on GitHub ↗
(t *testing.T, db *dbmock.MockStore)

Source from the content-addressed store, hash-verified

659}
660
661func configureMockDeployment(t *testing.T, db *dbmock.MockStore) (uuid.UUID, string) {
662 t.Helper()
663 deploymentID := uuid.New()
664 db.EXPECT().GetDeploymentID(gomock.Any()).Return(deploymentID.String(), nil).Times(1)
665
666 licenseRaw := coderdenttest.GenerateLicense(t, coderdenttest.LicenseOptions{
667 PublishUsageData: true,
668 })
669 db.EXPECT().GetUnexpiredLicenses(gomock.Any()).Return([]database.License{
670 {
671 ID: 1,
672 UploadedAt: dbtime.Now(),
673 JWT: licenseRaw,
674 Exp: dbtime.Now().Add(48 * time.Hour),
675 UUID: uuid.New(),
676 },
677 }, nil)
678
679 return deploymentID, licenseRaw
680}
681
682func fakeServer(t *testing.T, handler http.Handler) string {
683 t.Helper()

Callers 2

Calls 9

GenerateLicenseFunction · 0.92
NowFunction · 0.92
HelperMethod · 0.65
NewMethod · 0.65
GetDeploymentIDMethod · 0.65
GetUnexpiredLicensesMethod · 0.65
AddMethod · 0.65
EXPECTMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected