mirror of
https://github.com/PrivateCaptcha/PrivateCaptcha.git
synced 2026-05-08 05:50:50 -05:00
Fix build
This commit is contained in:
+7
-7
@@ -709,10 +709,10 @@ func TestAPIOrgValidationErrors(t *testing.T) {
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
method string
|
||||
input *apiOrgInput
|
||||
wantCode common.StatusCode
|
||||
name string
|
||||
method string
|
||||
input *apiOrgInput
|
||||
wantCode common.StatusCode
|
||||
}{
|
||||
{
|
||||
name: "Create Org - ID Not Empty",
|
||||
@@ -735,7 +735,7 @@ func TestAPIOrgValidationErrors(t *testing.T) {
|
||||
{
|
||||
name: "Update Org - Empty Name",
|
||||
method: http.MethodPut,
|
||||
input: &apiOrgInput{ID: s.IDHasher.Encrypt(1), Name: ""},
|
||||
input: &apiOrgInput{ID: server.IDHasher.Encrypt(1), Name: ""},
|
||||
wantCode: common.StatusOrgNameEmptyError,
|
||||
},
|
||||
{
|
||||
@@ -810,14 +810,14 @@ func TestAPIOrgNoSubscription(t *testing.T) {
|
||||
name: "Update Org - No Subscription",
|
||||
method: http.MethodPut,
|
||||
endpoint: "/" + common.OrgEndpoint,
|
||||
input: &apiOrgInput{ID: s.IDHasher.Encrypt(int(org.ID)), Name: "Updated"},
|
||||
input: &apiOrgInput{ID: server.IDHasher.Encrypt(int(org.ID)), Name: "Updated"},
|
||||
wantStatus: http.StatusPaymentRequired,
|
||||
},
|
||||
{
|
||||
name: "Delete Org - No Subscription",
|
||||
method: http.MethodDelete,
|
||||
endpoint: "/" + common.OrgEndpoint,
|
||||
input: &apiOrgInput{ID: s.IDHasher.Encrypt(int(org.ID))},
|
||||
input: &apiOrgInput{ID: server.IDHasher.Encrypt(int(org.ID))},
|
||||
wantStatus: http.StatusPaymentRequired,
|
||||
},
|
||||
}
|
||||
|
||||
+10
-10
@@ -1423,7 +1423,7 @@ func TestApiPostPropertiesValidationErrors(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
endpoint := fmt.Sprintf("/%s/%s/%s", common.OrgEndpoint, s.IDHasher.Encrypt(int(org.ID)), common.PropertiesEndpoint)
|
||||
endpoint := fmt.Sprintf("/%s/%s/%s", common.OrgEndpoint, server.IDHasher.Encrypt(int(org.ID)), common.PropertiesEndpoint)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -1509,23 +1509,23 @@ func TestApiUpdatePropertiesValidationErrors(t *testing.T) {
|
||||
{
|
||||
name: "Duplicate Property IDs",
|
||||
input: []*apiUpdatePropertyInput{
|
||||
{ID: s.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: "Name 1"}},
|
||||
{ID: s.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: "Name 2"}},
|
||||
{ID: server.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: "Name 1"}},
|
||||
{ID: server.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: "Name 2"}},
|
||||
},
|
||||
wantCode: common.StatusPropertyIDDuplicateError,
|
||||
},
|
||||
{
|
||||
name: "Duplicate Property Names",
|
||||
input: []*apiUpdatePropertyInput{
|
||||
{ID: s.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: "Same Name"}},
|
||||
{ID: s.IDHasher.Encrypt(2), apiPropertySettings: apiPropertySettings{Name: "Same Name"}},
|
||||
{ID: server.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: "Same Name"}},
|
||||
{ID: server.IDHasher.Encrypt(2), apiPropertySettings: apiPropertySettings{Name: "Same Name"}},
|
||||
},
|
||||
wantCode: common.StatusPropertyNameDuplicateError,
|
||||
},
|
||||
{
|
||||
name: "Empty Property Name",
|
||||
input: []*apiUpdatePropertyInput{
|
||||
{ID: s.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: ""}},
|
||||
{ID: server.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: ""}},
|
||||
},
|
||||
wantCode: common.StatusPropertyNameEmptyError,
|
||||
},
|
||||
@@ -1565,7 +1565,7 @@ func TestApiGetPropertiesNoSubscription(t *testing.T) {
|
||||
}
|
||||
apiKeyStr := db.UUIDToSecret(apikey.ExternalID)
|
||||
|
||||
endpoint := fmt.Sprintf("/%s/%s/%s", common.OrgEndpoint, s.IDHasher.Encrypt(int(org.ID)), common.PropertiesEndpoint)
|
||||
endpoint := fmt.Sprintf("/%s/%s/%s", common.OrgEndpoint, server.IDHasher.Encrypt(int(org.ID)), common.PropertiesEndpoint)
|
||||
resp, err := apiRequestSuite(ctx, nil, http.MethodGet, endpoint, apiKeyStr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -1596,7 +1596,7 @@ func TestApiGetPropertyNoSubscription(t *testing.T) {
|
||||
}
|
||||
apiKeyStr := db.UUIDToSecret(apikey.ExternalID)
|
||||
|
||||
endpoint := fmt.Sprintf("/%s/%s/%s/%s", common.OrgEndpoint, s.IDHasher.Encrypt(int(org.ID)), common.PropertyEndpoint, s.IDHasher.Encrypt(1))
|
||||
endpoint := fmt.Sprintf("/%s/%s/%s/%s", common.OrgEndpoint, server.IDHasher.Encrypt(int(org.ID)), common.PropertyEndpoint, server.IDHasher.Encrypt(1))
|
||||
resp, err := apiRequestSuite(ctx, nil, http.MethodGet, endpoint, apiKeyStr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -1650,7 +1650,7 @@ func TestApiDeletePropertiesNoSubscription(t *testing.T) {
|
||||
}
|
||||
apiKeyStr := db.UUIDToSecret(apikey.ExternalID)
|
||||
|
||||
input := []string{s.IDHasher.Encrypt(1)}
|
||||
input := []string{server.IDHasher.Encrypt(1)}
|
||||
resp, err := apiRequestSuite(ctx, input, http.MethodDelete, "/"+common.PropertiesEndpoint, apiKeyStr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -1682,7 +1682,7 @@ func TestApiUpdatePropertiesNoSubscription(t *testing.T) {
|
||||
apiKeyStr := db.UUIDToSecret(apikey.ExternalID)
|
||||
|
||||
input := []*apiUpdatePropertyInput{
|
||||
{ID: s.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: "Updated Name"}},
|
||||
{ID: server.IDHasher.Encrypt(1), apiPropertySettings: apiPropertySettings{Name: "Updated Name"}},
|
||||
}
|
||||
resp, err := apiRequestSuite(ctx, input, http.MethodPut, "/"+common.PropertiesEndpoint, apiKeyStr)
|
||||
if err != nil {
|
||||
|
||||
@@ -130,7 +130,7 @@ func TestGetAsyncTaskNoSubscription(t *testing.T) {
|
||||
|
||||
handlerID := xid.New().String()
|
||||
request := struct{}{}
|
||||
task, err := s.BusinessDB.Impl().CreateNewAsyncTask(ctx, request, handlerID, user, time.Now().UTC().Add(24*time.Hour), t.Name())
|
||||
task, err := server.BusinessDB.Impl().CreateNewAsyncTask(ctx, request, handlerID, user, time.Now().UTC().Add(24*time.Hour), t.Name())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user