add: Login system
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"GoMembership/internal/config"
|
||||
"GoMembership/internal/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -64,7 +63,6 @@ func validateSubscription(assert bool, wantDBData map[string]interface{}) error
|
||||
|
||||
func getBaseSubscription() MembershipData {
|
||||
return MembershipData{
|
||||
APIKey: config.Auth.APIKEY,
|
||||
Model: models.SubscriptionModel{
|
||||
Name: "Just a Subscription",
|
||||
Details: "A subscription detail",
|
||||
@@ -80,28 +78,6 @@ func customizeSubscription(customize func(MembershipData) MembershipData) Member
|
||||
|
||||
func getSubscriptionData() []RegisterSubscriptionTest {
|
||||
return []RegisterSubscriptionTest{
|
||||
{
|
||||
Name: "No API Key should fail",
|
||||
WantResponse: http.StatusUnauthorized,
|
||||
WantDBData: map[string]interface{}{"name": "Just a Subscription"},
|
||||
Assert: false,
|
||||
Input: GenerateInputJSON(
|
||||
customizeSubscription(func(subscription MembershipData) MembershipData {
|
||||
subscription.APIKey = ""
|
||||
return subscription
|
||||
})),
|
||||
},
|
||||
{
|
||||
Name: "Wrong API Key should fail",
|
||||
WantResponse: http.StatusUnauthorized,
|
||||
WantDBData: map[string]interface{}{"name": "Just a Subscription"},
|
||||
Assert: false,
|
||||
Input: GenerateInputJSON(
|
||||
customizeSubscription(func(subscription MembershipData) MembershipData {
|
||||
subscription.APIKey = "alskfdlkjsfjk23-dF"
|
||||
return subscription
|
||||
})),
|
||||
},
|
||||
{
|
||||
Name: "No Details should fail",
|
||||
WantResponse: http.StatusNotAcceptable,
|
||||
|
||||
Reference in New Issue
Block a user