mirror of
https://github.com/foomo/shop.git
synced 2025-10-16 12:35:39 +00:00
fix test for breaking change: email is no longer unique (due to guest accounts)
This commit is contained in:
parent
d9247d3a04
commit
0b02171d77
@ -24,14 +24,19 @@ func TestCredentials(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Try to create credentials for already taken email.
|
||||
// This should fail
|
||||
email = "alice@bar.com"
|
||||
password = "wonderland"
|
||||
err = CreateCustomerCredentials(email, password)
|
||||
if err == nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// ! ----------------------------------------------------------------------
|
||||
// ~ due to non unique mails creating multiple creds with same mail is allowed now
|
||||
// ! ----------------------------------------------------------------------
|
||||
|
||||
// // Try to create credentials for already taken email.
|
||||
// // This should fail
|
||||
// email = "alice@bar.com"
|
||||
// password = "wonderland"
|
||||
// err = CreateCustomerCredentials(email, password)
|
||||
// if err == nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
|
||||
// Change email
|
||||
err = ChangeEmail("foo@bar.com", "trent@bar.com")
|
||||
|
||||
@ -11,8 +11,8 @@ import (
|
||||
"github.com/foomo/shop/utils"
|
||||
"github.com/foomo/shop/version"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
"gopkg.in/mgo.v2"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
)
|
||||
|
||||
// !! NOTE: customer must not import order !!
|
||||
@ -246,10 +246,6 @@ func GetCustomerById(id string, customProvider CustomerCustomProvider) (*Custome
|
||||
return findOneCustomer(&bson.M{"id": id}, nil, "", customProvider, false)
|
||||
}
|
||||
|
||||
// GetCustomerByEmail // TODO this won't work for guests, because for guests there could be multiple entries for the same email address
|
||||
func GetCustomerByEmail(email string, customProvider CustomerCustomProvider) (*Customer, error) {
|
||||
return findOneCustomer(&bson.M{"email": email}, nil, "", customProvider, false)
|
||||
}
|
||||
func GetCurrentCustomerByIdFromVersionsHistory(customerId string, customProvider CustomerCustomProvider) (*Customer, error) {
|
||||
return findOneCustomer(&bson.M{"id": customerId}, nil, "-version.current", customProvider, true)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user