backend: membership errorhandling tests

This commit is contained in:
Alex
2025-02-28 10:05:25 +01:00
parent 386b50e857
commit 20754b4422
4 changed files with 17 additions and 15 deletions

View File

@@ -251,7 +251,7 @@ func getSubscriptionUpdateData() []UpdateSubscriptionTest {
return []UpdateSubscriptionTest{
{
Name: "Modified Monthly Fee, should fail",
WantResponse: http.StatusNotAcceptable,
WantResponse: http.StatusBadRequest,
WantDBData: map[string]interface{}{"name": "Premium", "monthly_fee": "12"},
Assert: true,
Input: GenerateInputJSON(
@@ -262,7 +262,7 @@ func getSubscriptionUpdateData() []UpdateSubscriptionTest {
},
{
Name: "Missing ID, should fail",
WantResponse: http.StatusNotAcceptable,
WantResponse: http.StatusBadRequest,
WantDBData: map[string]interface{}{"name": "Premium"},
Assert: true,
Input: GenerateInputJSON(
@@ -273,7 +273,7 @@ func getSubscriptionUpdateData() []UpdateSubscriptionTest {
},
{
Name: "Modified Hourly Rate, should fail",
WantResponse: http.StatusNotAcceptable,
WantResponse: http.StatusBadRequest,
WantDBData: map[string]interface{}{"name": "Premium", "hourly_rate": "14"},
Assert: true,
Input: GenerateInputJSON(
@@ -284,7 +284,7 @@ func getSubscriptionUpdateData() []UpdateSubscriptionTest {
},
{
Name: "IncludedPerYear changed, should fail",
WantResponse: http.StatusNotAcceptable,
WantResponse: http.StatusBadRequest,
WantDBData: map[string]interface{}{"name": "Premium", "included_per_year": "0"},
Assert: true,
Input: GenerateInputJSON(
@@ -295,7 +295,7 @@ func getSubscriptionUpdateData() []UpdateSubscriptionTest {
},
{
Name: "IncludedPerMonth changed, should fail",
WantResponse: http.StatusNotAcceptable,
WantResponse: http.StatusBadRequest,
WantDBData: map[string]interface{}{"name": "Premium", "included_per_month": "1"},
Assert: true,
Input: GenerateInputJSON(
@@ -306,7 +306,7 @@ func getSubscriptionUpdateData() []UpdateSubscriptionTest {
},
{
Name: "Update non-existent subscription should fail",
WantResponse: http.StatusNotAcceptable,
WantResponse: http.StatusNotFound,
WantDBData: map[string]interface{}{"name": "NonExistentSubscription"},
Assert: false,
Input: GenerateInputJSON(
@@ -343,7 +343,7 @@ func getSubscriptionDeleteData() []DeleteSubscriptionTest {
return []DeleteSubscriptionTest{
{
Name: "Delete non-existent subscription should fail",
WantResponse: http.StatusExpectationFailed,
WantResponse: http.StatusNotFound,
WantDBData: map[string]interface{}{"name": "NonExistentSubscription"},
Assert: false,
Input: GenerateInputJSON(