mirror of
https://gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud
synced 2024-11-25 01:56:23 +00:00
removed concurents user createfull and update tests
This commit is contained in:
parent
e10f775918
commit
d6551164b8
@ -1,8 +1,6 @@
|
|||||||
package gonextcloud
|
package gonextcloud
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"github.com/fatih/structs"
|
|
||||||
"github.com/partitio/gonextcloud/types"
|
"github.com/partitio/gonextcloud/types"
|
||||||
"github.com/partitio/swarmmanager/libnextcloudpartitio/utils"
|
"github.com/partitio/swarmmanager/libnextcloudpartitio/utils"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -11,7 +9,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -99,69 +96,69 @@ func TestUserCreate(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserCreateFull(t *testing.T) {
|
//func TestUserCreateFull(t *testing.T) {
|
||||||
if err := initClient(); err != nil {
|
// if err := initClient(); err != nil {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
username := fmt.Sprintf("%s-2", config.NotExistingUser)
|
// username := fmt.Sprintf("%s-2", config.NotExistingUser)
|
||||||
user := &types.User{
|
// user := &types.User{
|
||||||
ID: username,
|
// ID: username,
|
||||||
Displayname: strings.ToUpper(username),
|
// Displayname: strings.ToUpper(username),
|
||||||
Email: "some@address.com",
|
// Email: "some@address.com",
|
||||||
Address: "Main Street, City",
|
// Address: "Main Street, City",
|
||||||
Twitter: "@me",
|
// Twitter: "@me",
|
||||||
Phone: "42 42 242 424",
|
// Phone: "42 42 242 424",
|
||||||
Website: "my.site.com",
|
// Website: "my.site.com",
|
||||||
}
|
// }
|
||||||
err := c.UserCreate(username, password, user)
|
// err := c.UserCreate(username, password, user)
|
||||||
assert.Nil(t, err)
|
// assert.Nil(t, err)
|
||||||
u, err := c.User(username)
|
// u, err := c.User(username)
|
||||||
assert.NoError(t, err)
|
// assert.NoError(t, err)
|
||||||
o := structs.Map(user)
|
// o := structs.Map(user)
|
||||||
r := structs.Map(u)
|
// r := structs.Map(u)
|
||||||
for k := range o {
|
// for k := range o {
|
||||||
if ignoredUserField(k) {
|
// if ignoredUserField(k) {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
assert.Equal(t, o[k], r[k])
|
// assert.Equal(t, o[k], r[k])
|
||||||
}
|
// }
|
||||||
// Clean up
|
// // Clean up
|
||||||
err = c.UserDelete(u.ID)
|
// err = c.UserDelete(u.ID)
|
||||||
assert.NoError(t, err)
|
// assert.NoError(t, err)
|
||||||
}
|
//}
|
||||||
|
|
||||||
func TestUserUpdate(t *testing.T) {
|
//func TestUserUpdate(t *testing.T) {
|
||||||
if err := initClient(); err != nil {
|
// if err := initClient(); err != nil {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
username := fmt.Sprintf("%s-2", config.NotExistingUser)
|
// username := fmt.Sprintf("%s-2", config.NotExistingUser)
|
||||||
err := c.UserCreate(username, password, nil)
|
// err := c.UserCreate(username, password, nil)
|
||||||
assert.Nil(t, err)
|
// assert.Nil(t, err)
|
||||||
user := &types.User{
|
// user := &types.User{
|
||||||
ID: username,
|
// ID: username,
|
||||||
Displayname: strings.ToUpper(username),
|
// Displayname: strings.ToUpper(username),
|
||||||
Email: "some@address.com",
|
// Email: "some@address.com",
|
||||||
Address: "Main Street, City",
|
// Address: "Main Street, City",
|
||||||
Twitter: "@me",
|
// Twitter: "@me",
|
||||||
Phone: "42 42 242 424",
|
// Phone: "42 42 242 424",
|
||||||
Website: "my.site.com",
|
// Website: "my.site.com",
|
||||||
}
|
// }
|
||||||
err = c.UserUpdate(user)
|
// err = c.UserUpdate(user)
|
||||||
assert.Nil(t, err)
|
// assert.Nil(t, err)
|
||||||
u, err := c.User(username)
|
// u, err := c.User(username)
|
||||||
assert.Nil(t, err)
|
// assert.Nil(t, err)
|
||||||
o := structs.Map(user)
|
// o := structs.Map(user)
|
||||||
r := structs.Map(u)
|
// r := structs.Map(u)
|
||||||
for k := range o {
|
// for k := range o {
|
||||||
if ignoredUserField(k) {
|
// if ignoredUserField(k) {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
assert.Equal(t, o[k], r[k])
|
// assert.Equal(t, o[k], r[k])
|
||||||
}
|
// }
|
||||||
// Clean up
|
// // Clean up
|
||||||
err = c.UserDelete(u.ID)
|
// err = c.UserDelete(u.ID)
|
||||||
assert.NoError(t, err)
|
// assert.NoError(t, err)
|
||||||
}
|
//}
|
||||||
|
|
||||||
func TestUserCreateExisting(t *testing.T) {
|
func TestUserCreateExisting(t *testing.T) {
|
||||||
err := c.UserCreate(config.NotExistingUser, password, nil)
|
err := c.UserCreate(config.NotExistingUser, password, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user