func Test_GetCustomerAddresses(t *testing.T) { Convey("no shop identifier", t, func() { response = httprunner.Request("GET", "/shopify/customers/1234/addresses", nil, GetAddresses) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) vals := make(url.Values, 0) vals.Add("shop", "testing") response = httprunner.Request("GET", "/shopify/customers/1234/addresses", nil, GetAddresses) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) }) Convey("with shop identifier", t, func() { shopID := cart.InsertTestData() So(shopID, ShouldNotBeNil) val := shopID.Hex() qs := make(url.Values, 0) qs.Add("shop", val) Convey("with bad customer reference", func() { response = httprunner.ParameterizedRequest("GET", "/shopify/customers/:id/addresses", "/shopify/customers/1234/addresses", &qs, nil, GetAddresses) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) }) Convey("with good customer reference", func() { cust := cart.Customer{ ShopId: *shopID, FirstName: "Alex", LastName: "Ninneman", Email: time.Now().Format(time.RFC3339Nano) + "@gmail.com", Password: "******", } response = httprunner.JsonRequest("POST", "/shopify/customers", &qs, cust, AddCustomer) t.Log(response.Body.String()) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &cust), ShouldBeNil) response = httprunner.ParameterizedRequest("GET", "/shopify/customers/:id/addresses", "/shopify/customers/"+shopID.Hex()+"/addresses", &qs, nil, GetAddresses) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) response = httprunner.ParameterizedRequest("GET", "/shopify/customers/:id/addresses", "/shopify/customers/"+cust.Id.Hex()+"/addresses", &qs, nil, GetAddresses) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &[]cart.CustomerAddress{}), ShouldBeNil) qs.Add("limit", "10") qs.Add("page", "1") response = httprunner.ParameterizedRequest("GET", "/shopify/customers/:id/addresses", "/shopify/customers/"+cust.Id.Hex()+"/addresses", &qs, nil, GetAddresses) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &[]cart.CustomerAddress{}), ShouldBeNil) }) }) }
func TestTechSupport(te *testing.T) { dtx, err := apicontextmock.Mock() if err != nil { te.Log(err) } Convey("TechSupport", te, func() { var t techSupport.TechSupport var ts []techSupport.TechSupport qs := make(url.Values, 0) qs.Add("key", dtx.APIKey) t.Contact.LastName = "test contact" t.Contact.FirstName = "test contact first" t.Contact.Email = "*****@*****.**" t.Contact.Type = "test" t.Contact.Subject = "test" t.Contact.Message = "test" t.Contact.Brand.ID = dtx.BrandID t.BrandID = dtx.BrandID err = t.Contact.Add(dtx) So(err, ShouldBeNil) response := httprunner.ParameterizedJsonRequest("POST", "/techSupport/:contactReceiverTypeID/:sendEmail", "/techSupport/1/false", &qs, t, CreateTechSupport) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &t), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/techSupport/:id", "/techSupport/"+strconv.Itoa(t.ID), &qs, nil, GetTechSupport) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &t), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/techSupport/contact/:id", "/techSupport/contact/"+strconv.Itoa(t.Contact.ID), &qs, nil, GetTechSupportByContact) te.Log(response.Body) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &ts), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/techSupport", "/techSupport", &qs, nil, GetAllTechSupport) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &ts), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/techSupport/:id", "/techSupport/"+strconv.Itoa(t.ID), &qs, nil, DeleteTechSupport) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &t), ShouldEqual, nil) err = t.Contact.Delete() So(err, ShouldBeNil) }) _ = apicontextmock.DeMock(dtx) }
func TestTestTestimonials(t *testing.T) { dtx, err := apicontextmock.Mock() if err != nil { t.Log(err) } Convey("Testimonials", t, func() { var test testimonials.Testimonial var tests testimonials.Testimonials qs := make(url.Values, 0) qs.Add("key", dtx.APIKey) test.BrandID = dtx.BrandID test.Content = "test content - controller test" response := httprunner.ParameterizedJsonRequest("POST", "/testimonials", "/testimonials", &qs, test, Save) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &test), ShouldEqual, nil) test.FirstName = "test name" response = httprunner.ParameterizedJsonRequest("PUT", "/testimonials", "/testimonials", &qs, test, Save) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &test), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/testimonials/:id", "/testimonials/"+strconv.Itoa(test.ID), &qs, nil, GetTestimonial) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &test), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/testimonials", "/testimonials", &qs, nil, GetAllTestimonials) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &tests), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/testimonials/:id", "/testimonials/"+strconv.Itoa(test.ID), &qs, nil, Delete) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &test), ShouldEqual, nil) }) _ = apicontextmock.DeMock(dtx) }
func TestSalesRep(t *testing.T) { dtx, err := apicontextmock.Mock() if err != nil { t.Log(err) } Convey("SalesRep", t, func() { var s salesrep.SalesRep var ss salesrep.SalesReps qs := make(url.Values, 0) qs.Add("key", dtx.APIKey) qs.Add("name", "Tim") qs.Add("code", "red") response := httprunner.ParameterizedRequest("POST", "/salesrep", "/salesrep", &qs, &qs, AddSalesRep) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &s), ShouldEqual, nil) qs.Set("name", "Bill") response = httprunner.ParameterizedRequest("PUT", "/salesrep/:id", "/salesrep/"+strconv.Itoa(s.ID), &qs, &qs, AddSalesRep) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &s), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/salesrep/:id", "/salesrep/"+strconv.Itoa(s.ID), &qs, nil, GetSalesRep) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &s), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/salesrep", "/salesrep", &qs, nil, GetAllSalesReps) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &ss), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/salesrep/:id", "/salesrep/"+strconv.Itoa(s.ID), &qs, nil, DeleteSalesRep) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &s), ShouldEqual, nil) }) _ = apicontextmock.DeMock(dtx) }
func TestVinLookup(t *testing.T) { dtx, err := apicontextmock.Mock() if err != nil { t.Log(err) } Convey("VinLookup", t, func() { var l products.Lookup vins := []string{"1GTJK34131E957990", "1GJHG39R2X1371269"} clean := database.GetCleanDBFlag() for _, vin := range vins { qs := make(url.Values, 0) qs.Add("key", dtx.APIKey) //test GetParts response := httprunner.ParameterizedRequest("GET", "/:vin", "/"+vin, &qs, nil, GetParts) if clean == "" && response.Code == 200 { So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &l), ShouldEqual, nil) } else { So(response.Code, ShouldEqual, 500) } //tet GetConfigs response = httprunner.ParameterizedRequest("GET", "/configs/:vin", "/configs/"+vin, &qs, nil, GetConfigs) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &l), ShouldEqual, nil) } }) _ = apicontextmock.DeMock(dtx) }
func TestSite(t *testing.T) { dtx, err := apicontextmock.Mock() if err != nil { t.Log(err) } Convey("Site Contents", t, func() { var c site.Content var contents site.Contents var cr site.ContentRevision c.WebsiteId = dtx.WebsiteID qs := make(url.Values, 0) qs.Add("key", dtx.APIKey) c.Title = "test content - controller test" cr.Text = "test revision - controller test" c.ContentRevisions = append(c.ContentRevisions, cr) response := httprunner.ParameterizedJsonRequest("POST", "/site/content", "/site/content", &qs, c, SaveContent) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &c), ShouldEqual, nil) c.Active = true response = httprunner.ParameterizedJsonRequest("PUT", "/site/content/:id", "/site/content/"+strconv.Itoa(c.Id), &qs, c, SaveContent) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &c), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/site/content/:id", "/site/content/"+strconv.Itoa(c.Id), &qs, nil, GetContent) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &c), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/site/content", "/site/content", &qs, nil, GetAllContents) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &contents), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/site/content/:id/revisions", "/site/content/"+strconv.Itoa(c.Id)+"/revisions", &qs, nil, GetContentRevisions) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &c), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/site/content/:id", "/site/content/"+strconv.Itoa(c.Id), &qs, nil, DeleteContent) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &c), ShouldEqual, nil) }) Convey("Site Menu", t, func() { var m site.Menu var menus site.Menus m.WebsiteId = dtx.WebsiteID qs := make(url.Values, 0) qs.Add("key", dtx.APIKey) m.Name = "test menu - controller test" response := httprunner.ParameterizedJsonRequest("POST", "/site/menu", "/site/menu", &qs, m, SaveMenu) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &m), ShouldEqual, nil) m.Active = true response = httprunner.ParameterizedJsonRequest("PUT", "/site/menu/:id", "/site/menu/"+strconv.Itoa(m.Id), &qs, m, SaveMenu) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &m), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/site/menu/:id", "/site/menu/"+strconv.Itoa(m.Id), &qs, nil, GetMenu) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &m), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/site/menu", "/site/menu", &qs, nil, GetAllMenus) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &menus), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/site/menu/contents/:id", "/site/menu/contents/"+strconv.Itoa(m.Id), &qs, nil, GetMenuWithContents) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &m), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/site/menu/:id", "/site/menu/"+strconv.Itoa(m.Id), &qs, nil, DeleteMenu) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &m), ShouldEqual, nil) }) Convey("Site Menu", t, func() { var s site.Website qs := make(url.Values, 0) qs.Add("key", dtx.APIKey) s.Description = "test site - controller test" response := httprunner.ParameterizedJsonRequest("POST", "/site", "/site", &qs, s, SaveSite) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &s), ShouldEqual, nil) s.Url = "www.controllertest.com" response = httprunner.ParameterizedJsonRequest("PUT", "/site/:id", "/site/"+strconv.Itoa(s.ID), &qs, s, SaveSite) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &s), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/site/:id/details", "/site/"+strconv.Itoa(s.ID)+"/details", &qs, nil, GetSiteDetails) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &s), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/site/:id", "/site/"+strconv.Itoa(s.ID), &qs, nil, DeleteSite) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &s), ShouldEqual, nil) }) _ = apicontextmock.DeMock(dtx) }
func TestWebProperty(t *testing.T) { dtx, err := apicontextmock.Mock() if err != nil { t.Log(err) } Convey("Test Web Property", t, func() { var wt webProperty_model.WebPropertyType var wr webProperty_model.WebPropertyRequirement var wn webProperty_model.WebPropertyNote var w webProperty_model.WebProperty var ws webProperty_model.WebProperties var wts []webProperty_model.WebPropertyType var wrs []webProperty_model.WebPropertyRequirement var wns []webProperty_model.WebPropertyNote qs := make(url.Values, 0) qs.Add("key", dtx.APIKey) w.CustID = dtx.CustomerID wt.Type = "controller test type" w.Name = "controller test name" wr.Compliance = true wn.Text = "controller test text" //POST response := httprunner.ParameterizedJsonRequest("POST", "/webProperties/json/type", "/webProperties/json/type", &qs, wt, CreateUpdateWebPropertyType) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wt), ShouldEqual, nil) wt.Type = "999" response = httprunner.ParameterizedJsonRequest("POST", "/webProperties/json/type/:id", "/webProperties/json/type/"+strconv.Itoa(wt.ID), &qs, wt, CreateUpdateWebPropertyType) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wt), ShouldEqual, nil) w.WebPropertyType = wt response = httprunner.ParameterizedJsonRequest("POST", "/webProperties/json/requirement", "/webProperties/json/requirement", &qs, wr, CreateUpdateWebPropertyRequirement) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wr), ShouldEqual, nil) response = httprunner.ParameterizedJsonRequest("POST", "/webProperties/json/requirement/:id", "/webProperties/json/requirement/"+strconv.Itoa(wr.RequirementID), &qs, wr, CreateUpdateWebPropertyRequirement) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wr), ShouldEqual, nil) w.WebPropertyRequirements = append(w.WebPropertyRequirements, wr) response = httprunner.ParameterizedJsonRequest("POST", "/webProperties/json/note", "/webProperties/json/note", &qs, wn, CreateUpdateWebPropertyNote) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wn), ShouldEqual, nil) response = httprunner.ParameterizedJsonRequest("POST", "/webProperties/json/note/:id", "/webProperties/json/note/"+strconv.Itoa(wn.ID), &qs, wn, CreateUpdateWebPropertyNote) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wn), ShouldEqual, nil) w.WebPropertyNotes = append(w.WebPropertyNotes, wn) response = httprunner.ParameterizedJsonRequest("POST", "/webProperties/json", "/webProperties/json", &qs, w, CreateUpdateWebProperty) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &w), ShouldEqual, nil) response = httprunner.ParameterizedJsonRequest("POST", "/webProperties/json/:id", "/webProperties/json/"+strconv.Itoa(w.ID), &qs, w, CreateUpdateWebProperty) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &w), ShouldEqual, nil) //GET response = httprunner.ParameterizedRequest("GET", "/webProperties/:id", "/webProperties/"+strconv.Itoa(w.ID), &qs, nil, Get) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &w), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/webProperties", "/webProperties", &qs, nil, GetAll) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &ws), ShouldEqual, nil) So(len(ws), ShouldBeGreaterThan, 0) response = httprunner.ParameterizedRequest("GET", "/webProperties/type/:id", "/webProperties/type/"+strconv.Itoa(wt.ID), &qs, nil, GetWebPropertyType) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wt), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/webProperties/type", "/webProperties/type/", &qs, nil, GetAllTypes) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wts), ShouldEqual, nil) So(len(wts), ShouldBeGreaterThan, 0) response = httprunner.ParameterizedRequest("GET", "/webProperties/requirement/:id", "/webProperties/requirement/"+strconv.Itoa(wr.RequirementID), &qs, nil, GetWebPropertyRequirement) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wr), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/webProperties/requirement", "/webProperties/requirement", &qs, nil, GetAllRequirements) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wrs), ShouldEqual, nil) So(len(wrs), ShouldBeGreaterThan, 0) response = httprunner.ParameterizedRequest("GET", "/webProperties/note/:id", "/webProperties/note/"+strconv.Itoa(wn.ID), &qs, nil, GetWebPropertyNote) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wn), ShouldEqual, nil) response = httprunner.ParameterizedRequest("GET", "/webProperties/note", "/webProperties/note/", &qs, nil, GetAllNotes) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wns), ShouldEqual, nil) So(len(wns), ShouldBeGreaterThan, 0) qs.Add("name", "controller test name") response = httprunner.ParameterizedRequest("GET", "/webProperties/search", "/webProperties/search/", &qs, nil, Search) So(response.Code, ShouldEqual, 200) var l interface{} So(json.Unmarshal(response.Body.Bytes(), &l), ShouldEqual, nil) //DELETE response = httprunner.ParameterizedRequest("DELETE", "/webProperties/requirement/:id", "/webProperties/requirement/"+strconv.Itoa(wr.RequirementID), &qs, nil, DeleteWebPropertyRequirement) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wr), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/webProperties/note/:id", "/webProperties/note/"+strconv.Itoa(wn.ID), &qs, nil, DeleteWebPropertyNote) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wn), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/webProperties/:id", "/webProperties/"+strconv.Itoa(w.ID), &qs, nil, DeleteWebProperty) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &w), ShouldEqual, nil) response = httprunner.ParameterizedRequest("DELETE", "/webProperties/type/:id", "/webProperties/type/"+strconv.Itoa(wt.ID), &qs, nil, DeleteWebPropertyType) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &wt), ShouldEqual, nil) }) _ = apicontextmock.DeMock(dtx) }
func Test_DeleteAddress(t *testing.T) { Convey("with shop identifier", t, func() { shopID := cart.InsertTestData() So(shopID, ShouldNotBeNil) qs := make(url.Values, 0) qs.Add("shop", shopID.Hex()) cust := cart.Customer{ ShopId: *shopID, FirstName: "Alex", LastName: "Ninneman", Email: time.Now().Format(time.RFC3339Nano) + "@gmail.com", Password: "******", } response = httprunner.JsonRequest("POST", "/shopify/customers", &qs, cust, AddCustomer) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &cust), ShouldBeNil) addr := cart.CustomerAddress{ Address1: "1119 Sunset Lane", City: "Altoona", Company: "AN & Co.", FirstName: "Alex", LastName: "Ninneman", Phone: "7153082604", Province: "Wisconsin", ProvinceCode: "WI", Country: "US", CountryCode: "US", CountryName: "United States", Zip: "54720", } response = httprunner.ParameterizedJsonRequest("POST", "/shopify/customers/:id/addresses", "/shopify/customers/"+cust.Id.Hex()+"/addresses", &qs, &addr, AddAddress) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &addr), ShouldBeNil) response = httprunner.ParameterizedRequest("DELETE", "/shopify/customers/:id/addresses/:address", "/shopify/customers/1234/addresses/1234", &qs, nil, DeleteAddress) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) response = httprunner.ParameterizedRequest("DELETE", "/shopify/customers/:id/addresses/:address", "/shopify/customers/"+shopID.Hex()+"/addresses/1234", &qs, nil, DeleteAddress) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) response = httprunner.ParameterizedRequest("DELETE", "/shopify/customers/:id/addresses/:address", "/shopify/customers/"+cust.Id.Hex()+"/addresses/1234", &qs, nil, DeleteAddress) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) response = httprunner.ParameterizedRequest("DELETE", "/shopify/customers/:id/addresses/:address", "/shopify/customers/"+cust.Id.Hex()+"/addresses/"+cust.Id.Hex(), &qs, nil, DeleteAddress) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) response = httprunner.ParameterizedJsonRequest("PUT", "/shopify/customers/:id/addresses/:address/default", "/shopify/customers/"+cust.Id.Hex()+"/addresses/"+addr.Id.Hex()+"/default", &qs, &addr, SetDefaultAddress) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &cust), ShouldBeNil) response = httprunner.ParameterizedRequest("DELETE", "/shopify/customers/:id/addresses/:address", "/shopify/customers/"+cust.Id.Hex()+"/addresses/"+addr.Id.Hex(), &qs, nil, DeleteAddress) So(response.Code, ShouldEqual, 500) So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil) response = httprunner.ParameterizedJsonRequest("POST", "/shopify/customers/:id/addresses", "/shopify/customers/"+cust.Id.Hex()+"/addresses", &qs, &addr, AddAddress) So(response.Code, ShouldEqual, 200) So(json.Unmarshal(response.Body.Bytes(), &addr), ShouldBeNil) response = httprunner.ParameterizedRequest("DELETE", "/shopify/customers/:id/addresses/:address", "/shopify/customers/"+cust.Id.Hex()+"/addresses/"+addr.Id.Hex(), &qs, nil, DeleteAddress) So(response.Code, ShouldEqual, 200) So(response.Body.String(), ShouldEqual, "") }) }