Skip to content

Commit

Permalink
Merge pull request #75 from luthermonson/password
Browse files Browse the repository at this point in the history
add Password
  • Loading branch information
luthermonson authored Aug 20, 2023
2 parents 44b7c4b + 44ad5b0 commit 3fc1df1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions access.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ func (c *Client) Permissions(o *PermissionsOptions) (permissions Permissions, er

return permissions, c.Get(u.String(), &permissions)
}

func (c *Client) Password(userid, password string) error {
var res string
return c.Post("/access/password", map[string]string{"userid": userid, "password": password}, &res)
}
8 changes: 8 additions & 0 deletions access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,11 @@ func TestPermissions(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, 3, perms["path"]["permission"])
}

func TestPassword(t *testing.T) {
mocks.On(mockConfig)
defer mocks.Off()
client := mockClient()

assert.Nil(t, client.Password("userid", "password"))
}
5 changes: 5 additions & 0 deletions tests/mocks/pve7x/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ func access() {
}
}
}`)

gock.New(config.C.URI).
Post("^/access/password").
Reply(200).
JSON(`{"success":1,"data":null}`)
}

func ticket() {
Expand Down

0 comments on commit 3fc1df1

Please sign in to comment.