Merge lp:~allenap/gwacl/test-unused-chs-fields into lp:gwacl

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 120
Merged at revision: 118
Proposed branch: lp:~allenap/gwacl/test-unused-chs-fields
Merge into: lp:gwacl
Prerequisite: lp:~allenap/gwacl/test-unused-osimage-fields
Diff against target: 88 lines (+51/-8)
2 files modified
xmlobjects.go (+10/-8)
xmlobjects_test.go (+41/-0)
To merge this branch: bzr merge lp:~allenap/gwacl/test-unused-chs-fields
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+170396@code.launchpad.net

Commit message

Test CreateHostedService for use with Create Hosted Service calls.

Previously several fields of CreateHostedService were untested.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 review: approve

Wow, I didn't think we'd missed this much testing. Thanks for fixing
(this and the others).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHCWcUACgkQWhGlTF8G/HfyoACeL3/ANwke46rdlY4JAsaUzz8I
JNQAoIkvDKEZiY+4FsjxeNCA/R09r81Z
=6ow/
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'xmlobjects.go'
--- xmlobjects.go 2013-06-19 16:21:29 +0000
+++ xmlobjects.go 2013-06-19 16:21:29 +0000
@@ -308,15 +308,13 @@
308}308}
309309
310type CreateHostedService struct {310type CreateHostedService struct {
311 // See http://msdn.microsoft.com/en-us/library/windowsazure/hh264518.aspx311 XMLNS string `xml:"xmlns,attr"`
312 XMLNS string `xml:"xmlns,attr"`312 ServiceName string `xml:"ServiceName"`
313 ServiceName string `xml:"ServiceName"`313 Label string `xml:"Label"` // base64-encoded
314 // Label is base64-encoded.314 Description string `xml:"Description"`
315 Label string `xml:"Label"`
316 Description string `xml:"Description,omitempty"`
317 AffinityGroup string `xml:"AffinityGroup,omitempty"`
318 Location string `xml:"Location,omitempty"`315 Location string `xml:"Location,omitempty"`
319 ExtendedProperties []ExtendedProperty `xml:"ExtendedProperties>ExtendedProperty,omitempty"`316 AffinityGroup string `xml:"AffinityGroup"`
317 ExtendedProperties []ExtendedProperty `xml:"ExtendedProperties>ExtendedProperty"`
320}318}
321319
322func NewCreateHostedServiceWithLocation(serviceName, label, location string) *CreateHostedService {320func NewCreateHostedServiceWithLocation(serviceName, label, location string) *CreateHostedService {
@@ -329,6 +327,10 @@
329 }327 }
330}328}
331329
330func (s *CreateHostedService) Deserialize(data []byte) error {
331 return xml.Unmarshal(data, s)
332}
333
332//334//
333// Deployment bits335// Deployment bits
334//336//
335337
=== modified file 'xmlobjects_test.go'
--- xmlobjects_test.go 2013-06-19 16:21:29 +0000
+++ xmlobjects_test.go 2013-06-19 16:21:29 +0000
@@ -644,6 +644,47 @@
644 c.Assert(observed.Containers[0].Metadata.Items[0].Name(), Equals, "metadata-name")644 c.Assert(observed.Containers[0].Metadata.Items[0].Name(), Equals, "metadata-name")
645}645}
646646
647// TestCreateStorageService demonstrates that CreateHostedService is a
648// suitable container for the CreateHostedService XML tree that are required
649// for the Create Hosted Service API call.
650func (suite *xmlSuite) TestCreateHostedService(c *C) {
651 // From http://msdn.microsoft.com/en-us/library/windowsazure/gg441304.aspx
652 input := `
653 <?xml version="1.0" encoding="utf-8"?>
654 <CreateHostedService xmlns="http://schemas.microsoft.com/windowsazure">
655 <ServiceName>service-name</ServiceName>
656 <Label>base64-encoded-service-label</Label>
657 <Description>description</Description>
658 <Location>location</Location>
659 <AffinityGroup>affinity-group</AffinityGroup>
660 <ExtendedProperties>
661 <ExtendedProperty>
662 <Name>property-name</Name>
663 <Value>property-value</Value>
664 </ExtendedProperty>
665 </ExtendedProperties>
666 </CreateHostedService>
667 `
668 expected := &CreateHostedService{
669 XMLNS: XMLNS,
670 ServiceName: "service-name",
671 Label: "base64-encoded-service-label",
672 Description: "description",
673 Location: "location",
674 AffinityGroup: "affinity-group",
675 ExtendedProperties: []ExtendedProperty{
676 {
677 Name: "property-name",
678 Value: "property-value",
679 },
680 },
681 }
682 observed := &CreateHostedService{}
683 err := observed.Deserialize([]byte(input))
684 c.Assert(err, IsNil)
685 c.Assert(observed, DeepEquals, expected)
686}
687
647func (suite *xmlSuite) TestNewCreateHostedServiceWithLocation(c *C) {688func (suite *xmlSuite) TestNewCreateHostedServiceWithLocation(c *C) {
648 serviceName := "serviceName"689 serviceName := "serviceName"
649 label := "label"690 label := "label"

Subscribers

People subscribed via source and target branches

to all changes: