Identity v3 Projects Create (#165)
* Identity v3 Projects Create
* Removing unused createErr function
diff --git a/openstack/identity/v3/projects/testing/fixtures.go b/openstack/identity/v3/projects/testing/fixtures.go
index cb10313..0c839b8 100644
--- a/openstack/identity/v3/projects/testing/fixtures.go
+++ b/openstack/identity/v3/projects/testing/fixtures.go
@@ -55,6 +55,16 @@
}
`
+// CreateRequest provides the input to a Create request.
+const CreateRequest = `
+{
+ "project": {
+ "description": "The team that is red",
+ "name": "Red Team"
+ }
+}
+`
+
// RedTeam is a Project fixture.
var RedTeam = projects.Project{
IsDomain: false,
@@ -107,3 +117,16 @@
fmt.Fprintf(w, GetOutput)
})
}
+
+// HandleCreateProjectSuccessfully creates an HTTP handler at `/projects` on the
+// test handler mux that tests project creation.
+func HandleCreateProjectSuccessfully(t *testing.T) {
+ th.Mux.HandleFunc("/projects", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "POST")
+ th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
+ th.TestJSONRequest(t, r, CreateRequest)
+
+ w.WriteHeader(http.StatusCreated)
+ fmt.Fprintf(w, GetOutput)
+ })
+}