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

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 119
Merged at revision: 117
Proposed branch: lp:~allenap/gwacl/test-unused-osimage-fields
Merge into: lp:gwacl
Diff against target: 175 lines (+152/-0)
2 files modified
xmlobjects.go (+5/-0)
xmlobjects_test.go (+147/-0)
To merge this branch: bzr merge lp:~allenap/gwacl/test-unused-osimage-fields
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+170343@code.launchpad.net

Commit message

Test OSImage for use with Add OS Image, List OS Images, and Update OS Image calls.

Previously several fields of OSImage 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHCWNMACgkQWhGlTF8G/HeASwCfXoe06ybQa075rkb9To1MXAyi
n2gAniX5MJddHLEKjYnXTXZs0RXqW1Er
=gNvw
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'xmlobjects.go'
2--- xmlobjects.go 2013-06-18 15:43:10 +0000
3+++ xmlobjects.go 2013-06-19 13:09:58 +0000
4@@ -172,8 +172,13 @@
5 PublishedDate string `xml:"PublishedDate,omitempty"`
6 IsPremium string `xml:"IsPremium,omitempty"`
7 PrivacyURI string `xml:"PrivacyUri,omitempty"`
8+ PricingDetailLink string `xml:"PricingDetailLink,omitempty"`
9+ IconURI string `xml:"IconUri,omitempty"`
10 RecommendedVMSize string `xml:"RecommendedVMSize,omitempty"`
11 PublisherName string `xml:"PublisherName"`
12+ ShowInGUI string `xml:"ShowInGui"`
13+ SmallIconURI string `xml:"SmallIconUri,omitempty"`
14+ Language string `xml:"Language"`
15 }
16
17 func (image *OSImage) hasLocation(location string) bool {
18
19=== modified file 'xmlobjects_test.go'
20--- xmlobjects_test.go 2013-05-15 07:51:24 +0000
21+++ xmlobjects_test.go 2013-06-19 13:09:58 +0000
22@@ -746,6 +746,153 @@
23 c.Check(string(xml), Equals, expectedXML)
24 }
25
26+// TestOSImageWRTAddOSImage demonstrates the OSImage is a suitable container
27+// for the OSImage XML trees that are required for the Add OS Image API call.
28+func (suite *xmlSuite) TestOSImageWRTAddOSImage(c *C) {
29+ // From http://msdn.microsoft.com/en-us/library/windowsazure/jj157192.aspx
30+ input := `
31+ <OSImage xmlns="http://schemas.microsoft.com/windowsazure">
32+ <Label>image-label</Label>
33+ <MediaLink>uri-of-the-containing-blob</MediaLink>
34+ <Name>image-name</Name>
35+ <OS>Linux|Windows</OS>
36+ <Eula>image-eula</Eula>
37+ <Description>image-description</Description>
38+ <ImageFamily>image-family</ImageFamily>
39+ <PublishedDate>published-date</PublishedDate>
40+ <IsPremium>true/false</IsPremium>
41+ <ShowInGui>true/false</ShowInGui>
42+ <PrivacyUri>http://www.example.com/privacypolicy.html</PrivacyUri>
43+ <IconUri>http://www.example.com/favicon.png</IconUri>
44+ <RecommendedVMSize>Small/Large/Medium/ExtraLarge</RecommendedVMSize>
45+ <SmallIconUri>http://www.example.com/smallfavicon.png</SmallIconUri>
46+ <Language>language-of-image</Language>
47+ </OSImage>
48+ `
49+ expected := &OSImage{
50+ Label: "image-label",
51+ MediaLink: "uri-of-the-containing-blob",
52+ Name: "image-name",
53+ OS: "Linux|Windows",
54+ EULA: "image-eula",
55+ Description: "image-description",
56+ ImageFamily: "image-family",
57+ PublishedDate: "published-date",
58+ IsPremium: "true/false",
59+ ShowInGUI: "true/false",
60+ PrivacyURI: "http://www.example.com/privacypolicy.html",
61+ IconURI: "http://www.example.com/favicon.png",
62+ RecommendedVMSize: "Small/Large/Medium/ExtraLarge",
63+ SmallIconURI: "http://www.example.com/smallfavicon.png",
64+ Language: "language-of-image",
65+ }
66+
67+ osimage := &OSImage{}
68+ err := osimage.Deserialize([]byte(input))
69+ c.Assert(err, IsNil)
70+ c.Assert(osimage, DeepEquals, expected)
71+}
72+
73+// TestOSImageWRTListOSImages demonstrates that OSImage is a suitable
74+// container for the OSImage XML subtrees that are returned from the List OS
75+// Images API call.
76+func (suite *xmlSuite) TestOSImageWRTListOSImages(c *C) {
77+ // From http://msdn.microsoft.com/en-us/library/windowsazure/jj157191.aspx
78+ input := `
79+ <OSImage xmlns="http://schemas.microsoft.com/windowsazure">
80+ <AffinityGroup>name-of-the-affinity-group</AffinityGroup>
81+ <Category>category-of-the-image</Category>
82+ <Label>image-description</Label>
83+ <Location>geo-location-of-the-stored-image</Location>
84+ <LogicalSizeInGB>123.456</LogicalSizeInGB>
85+ <MediaLink>url-of-the-containing-blob</MediaLink>
86+ <Name>image-name</Name>
87+ <OS>operating-system-of-the-image</OS>
88+ <Eula>image-eula</Eula>
89+ <Description>image-description</Description>
90+ <ImageFamily>image-family</ImageFamily>
91+ <ShowInGui>true|false</ShowInGui>
92+ <PublishedDate>published-date</PublishedDate>
93+ <IsPremium>true|false</IsPremium>
94+ <PrivacyUri>uri-of-privacy-policy</PrivacyUri>
95+ <RecommendedVMSize>size-of-the-virtual-machine</RecommendedVMSize>
96+ <PublisherName>publisher-identifier</PublisherName>
97+ <PricingDetailLink>pricing-details</PricingDetailLink>
98+ <SmallIconUri>uri-of-icon</SmallIconUri>
99+ <Language>language-of-image</Language>
100+ </OSImage>
101+ `
102+ expected := &OSImage{
103+ AffinityGroup: "name-of-the-affinity-group",
104+ Category: "category-of-the-image",
105+ Label: "image-description",
106+ Location: "geo-location-of-the-stored-image",
107+ LogicalSizeInGB: 123.456,
108+ MediaLink: "url-of-the-containing-blob",
109+ Name: "image-name",
110+ OS: "operating-system-of-the-image",
111+ EULA: "image-eula",
112+ Description: "image-description",
113+ ImageFamily: "image-family",
114+ ShowInGUI: "true|false",
115+ PublishedDate: "published-date",
116+ IsPremium: "true|false",
117+ PrivacyURI: "uri-of-privacy-policy",
118+ RecommendedVMSize: "size-of-the-virtual-machine",
119+ PublisherName: "publisher-identifier",
120+ PricingDetailLink: "pricing-details",
121+ SmallIconURI: "uri-of-icon",
122+ Language: "language-of-image",
123+ }
124+
125+ osimage := &OSImage{}
126+ err := osimage.Deserialize([]byte(input))
127+ c.Assert(err, IsNil)
128+ c.Assert(osimage, DeepEquals, expected)
129+}
130+
131+// TestOSImageWRTUpdateOSImage demonstrates the OSImage is a suitable
132+// container for the OSImage XML trees that are required for the Update OS
133+// Image API call.
134+func (suite *xmlSuite) TestOSImageWRTUpdateOSImage(c *C) {
135+ // From http://msdn.microsoft.com/en-us/library/windowsazure/jj157198.aspx
136+ input := `
137+ <OSImage xmlns="http://schemas.microsoft.com/windowsazure">
138+ <Label>image-label</Label>
139+ <Eula>image-eula</Eula>
140+ <Description>Image-Description</Description>
141+ <ImageFamily>Image-Family</ImageFamily>
142+ <PublishedDate>published-date</PublishedDate>
143+ <IsPremium>true/false</IsPremium>
144+ <ShowInGui>true/false</ShowInGui>
145+ <PrivacyUri>http://www.example.com/privacypolicy.html</PrivacyUri>
146+ <IconUri>http://www.example.com/favicon.png</IconUri>
147+ <RecommendedVMSize>Small/Large/Medium/ExtraLarge</RecommendedVMSize>
148+ <SmallIconUri>http://www.example.com/smallfavicon.png</SmallIconUri>
149+ <Language>language-of-image</Language>
150+ </OSImage>
151+ `
152+ expected := &OSImage{
153+ Label: "image-label",
154+ EULA: "image-eula",
155+ Description: "Image-Description",
156+ ImageFamily: "Image-Family",
157+ PublishedDate: "published-date",
158+ IsPremium: "true/false",
159+ ShowInGUI: "true/false",
160+ PrivacyURI: "http://www.example.com/privacypolicy.html",
161+ IconURI: "http://www.example.com/favicon.png",
162+ RecommendedVMSize: "Small/Large/Medium/ExtraLarge",
163+ SmallIconURI: "http://www.example.com/smallfavicon.png",
164+ Language: "language-of-image",
165+ }
166+
167+ osimage := &OSImage{}
168+ err := osimage.Deserialize([]byte(input))
169+ c.Assert(err, IsNil)
170+ c.Assert(osimage, DeepEquals, expected)
171+}
172+
173 func (suite *xmlSuite) TestOSImageHasLocation(c *C) {
174 image := &OSImage{
175 Location: "East Asia;Southeast Asia;North Europe;West Europe;East US;West US",

Subscribers

People subscribed via source and target branches

to all changes: