blob: 7a1b773cda9ab5dae682d8ff6d1096dc63faeb79 [file] [log] [blame]
Jamie Hannaford3c1796b2015-02-12 14:21:33 +01001package users
2
3import (
4 "testing"
5
6 db "github.com/rackspace/gophercloud/openstack/db/v1/databases"
7 os "github.com/rackspace/gophercloud/openstack/db/v1/users"
Jamie Hannaford3c1796b2015-02-12 14:21:33 +01008 th "github.com/rackspace/gophercloud/testhelper"
9 fake "github.com/rackspace/gophercloud/testhelper/client"
10)
11
12const instanceID = "{instanceID}"
13
14func TestCreate(t *testing.T) {
15 th.SetupHTTP()
16 defer th.TeardownHTTP()
Jamie Hannaforde635b7d2015-02-18 14:11:46 +010017 os.HandleCreate(t)
Jamie Hannaford3c1796b2015-02-12 14:21:33 +010018
19 opts := os.BatchCreateOpts{
20 os.CreateOpts{
21 Databases: db.BatchCreateOpts{
22 db.CreateOpts{Name: "databaseA"},
23 },
24 Name: "dbuser3",
25 Password: "secretsecret",
26 },
27 os.CreateOpts{
28 Databases: db.BatchCreateOpts{
29 db.CreateOpts{Name: "databaseB"},
30 db.CreateOpts{Name: "databaseC"},
31 },
32 Name: "dbuser4",
33 Password: "secretsecret",
34 },
35 }
36
37 res := Create(fake.ServiceClient(), instanceID, opts)
38 th.AssertNoErr(t, res.Err)
39}
40
Jamie Hannaforde635b7d2015-02-18 14:11:46 +010041func TestDelete(t *testing.T) {
Jamie Hannaford3c1796b2015-02-12 14:21:33 +010042 th.SetupHTTP()
43 defer th.TeardownHTTP()
Jamie Hannaforde635b7d2015-02-18 14:11:46 +010044 os.HandleDelete(t)
Jamie Hannaford3c1796b2015-02-12 14:21:33 +010045
46 res := Delete(fake.ServiceClient(), instanceID, "{userName}")
47 th.AssertNoErr(t, res.Err)
48}