github.com/gophercloud/gophercloud@v1.11.0/openstack/keymanager/v1/acls/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/gophercloud/gophercloud/openstack/keymanager/v1/acls" 7 th "github.com/gophercloud/gophercloud/testhelper" 8 "github.com/gophercloud/gophercloud/testhelper/client" 9 ) 10 11 func TestGetSecretACL(t *testing.T) { 12 th.SetupHTTP() 13 defer th.TeardownHTTP() 14 HandleGetSecretACLSuccessfully(t) 15 16 actual, err := acls.GetSecretACL(client.ServiceClient(), "1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c").Extract() 17 th.AssertNoErr(t, err) 18 th.AssertDeepEquals(t, ExpectedACL, *actual) 19 } 20 21 func TestGetContainerACL(t *testing.T) { 22 th.SetupHTTP() 23 defer th.TeardownHTTP() 24 HandleGetContainerACLSuccessfully(t) 25 26 actual, err := acls.GetContainerACL(client.ServiceClient(), "1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c").Extract() 27 th.AssertNoErr(t, err) 28 th.AssertDeepEquals(t, ExpectedACL, *actual) 29 } 30 31 func TestSetSecretACL(t *testing.T) { 32 th.SetupHTTP() 33 defer th.TeardownHTTP() 34 HandleSetSecretACLSuccessfully(t) 35 36 users := []string{"GG27dVwR9gBMnsOaRoJ1DFJmZfdVjIdW"} 37 iFalse := false 38 setOpts := acls.SetOpts{ 39 acls.SetOpt{ 40 Type: "read", 41 Users: &users, 42 ProjectAccess: &iFalse, 43 }, 44 } 45 46 actual, err := acls.SetSecretACL(client.ServiceClient(), "1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c", setOpts).Extract() 47 th.AssertNoErr(t, err) 48 th.AssertDeepEquals(t, ExpectedSecretACLRef, *actual) 49 } 50 51 func TestSetContainerACL(t *testing.T) { 52 th.SetupHTTP() 53 defer th.TeardownHTTP() 54 HandleSetContainerACLSuccessfully(t) 55 56 users := []string{"GG27dVwR9gBMnsOaRoJ1DFJmZfdVjIdW"} 57 iFalse := false 58 setOpts := acls.SetOpts{ 59 acls.SetOpt{ 60 Type: "read", 61 Users: &users, 62 ProjectAccess: &iFalse, 63 }, 64 } 65 66 actual, err := acls.SetContainerACL(client.ServiceClient(), "1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c", setOpts).Extract() 67 th.AssertNoErr(t, err) 68 th.AssertDeepEquals(t, ExpectedContainerACLRef, *actual) 69 } 70 71 func TestDeleteSecretACL(t *testing.T) { 72 th.SetupHTTP() 73 defer th.TeardownHTTP() 74 HandleDeleteSecretACLSuccessfully(t) 75 76 res := acls.DeleteSecretACL(client.ServiceClient(), "1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c") 77 th.AssertNoErr(t, res.Err) 78 } 79 80 func TestDeleteContainerACL(t *testing.T) { 81 th.SetupHTTP() 82 defer th.TeardownHTTP() 83 HandleDeleteContainerACLSuccessfully(t) 84 85 res := acls.DeleteContainerACL(client.ServiceClient(), "1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c") 86 th.AssertNoErr(t, res.Err) 87 } 88 89 func TestUpdateSecretACL(t *testing.T) { 90 th.SetupHTTP() 91 defer th.TeardownHTTP() 92 HandleUpdateSecretACLSuccessfully(t) 93 94 newUsers := []string{} 95 updateOpts := acls.SetOpts{ 96 acls.SetOpt{ 97 Type: "read", 98 Users: &newUsers, 99 }, 100 } 101 102 actual, err := acls.UpdateSecretACL(client.ServiceClient(), "1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c", updateOpts).Extract() 103 th.AssertNoErr(t, err) 104 th.AssertDeepEquals(t, ExpectedSecretACLRef, *actual) 105 } 106 107 func TestUpdateContainerACL(t *testing.T) { 108 th.SetupHTTP() 109 defer th.TeardownHTTP() 110 HandleUpdateContainerACLSuccessfully(t) 111 112 newUsers := []string{} 113 updateOpts := acls.SetOpts{ 114 acls.SetOpt{ 115 Type: "read", 116 Users: &newUsers, 117 }, 118 } 119 120 actual, err := acls.UpdateContainerACL(client.ServiceClient(), "1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c", updateOpts).Extract() 121 th.AssertNoErr(t, err) 122 th.AssertDeepEquals(t, ExpectedContainerACLRef, *actual) 123 }