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
=== modified file 'xmlobjects.go'
--- xmlobjects.go 2013-06-18 15:43:10 +0000
+++ xmlobjects.go 2013-06-19 13:09:58 +0000
@@ -172,8 +172,13 @@
172 PublishedDate string `xml:"PublishedDate,omitempty"`172 PublishedDate string `xml:"PublishedDate,omitempty"`
173 IsPremium string `xml:"IsPremium,omitempty"`173 IsPremium string `xml:"IsPremium,omitempty"`
174 PrivacyURI string `xml:"PrivacyUri,omitempty"`174 PrivacyURI string `xml:"PrivacyUri,omitempty"`
175 PricingDetailLink string `xml:"PricingDetailLink,omitempty"`
176 IconURI string `xml:"IconUri,omitempty"`
175 RecommendedVMSize string `xml:"RecommendedVMSize,omitempty"`177 RecommendedVMSize string `xml:"RecommendedVMSize,omitempty"`
176 PublisherName string `xml:"PublisherName"`178 PublisherName string `xml:"PublisherName"`
179 ShowInGUI string `xml:"ShowInGui"`
180 SmallIconURI string `xml:"SmallIconUri,omitempty"`
181 Language string `xml:"Language"`
177}182}
178183
179func (image *OSImage) hasLocation(location string) bool {184func (image *OSImage) hasLocation(location string) bool {
180185
=== modified file 'xmlobjects_test.go'
--- xmlobjects_test.go 2013-05-15 07:51:24 +0000
+++ xmlobjects_test.go 2013-06-19 13:09:58 +0000
@@ -746,6 +746,153 @@
746 c.Check(string(xml), Equals, expectedXML)746 c.Check(string(xml), Equals, expectedXML)
747}747}
748748
749// TestOSImageWRTAddOSImage demonstrates the OSImage is a suitable container
750// for the OSImage XML trees that are required for the Add OS Image API call.
751func (suite *xmlSuite) TestOSImageWRTAddOSImage(c *C) {
752 // From http://msdn.microsoft.com/en-us/library/windowsazure/jj157192.aspx
753 input := `
754 <OSImage xmlns="http://schemas.microsoft.com/windowsazure">
755 <Label>image-label</Label>
756 <MediaLink>uri-of-the-containing-blob</MediaLink>
757 <Name>image-name</Name>
758 <OS>Linux|Windows</OS>
759 <Eula>image-eula</Eula>
760 <Description>image-description</Description>
761 <ImageFamily>image-family</ImageFamily>
762 <PublishedDate>published-date</PublishedDate>
763 <IsPremium>true/false</IsPremium>
764 <ShowInGui>true/false</ShowInGui>
765 <PrivacyUri>http://www.example.com/privacypolicy.html</PrivacyUri>
766 <IconUri>http://www.example.com/favicon.png</IconUri>
767 <RecommendedVMSize>Small/Large/Medium/ExtraLarge</RecommendedVMSize>
768 <SmallIconUri>http://www.example.com/smallfavicon.png</SmallIconUri>
769 <Language>language-of-image</Language>
770 </OSImage>
771 `
772 expected := &OSImage{
773 Label: "image-label",
774 MediaLink: "uri-of-the-containing-blob",
775 Name: "image-name",
776 OS: "Linux|Windows",
777 EULA: "image-eula",
778 Description: "image-description",
779 ImageFamily: "image-family",
780 PublishedDate: "published-date",
781 IsPremium: "true/false",
782 ShowInGUI: "true/false",
783 PrivacyURI: "http://www.example.com/privacypolicy.html",
784 IconURI: "http://www.example.com/favicon.png",
785 RecommendedVMSize: "Small/Large/Medium/ExtraLarge",
786 SmallIconURI: "http://www.example.com/smallfavicon.png",
787 Language: "language-of-image",
788 }
789
790 osimage := &OSImage{}
791 err := osimage.Deserialize([]byte(input))
792 c.Assert(err, IsNil)
793 c.Assert(osimage, DeepEquals, expected)
794}
795
796// TestOSImageWRTListOSImages demonstrates that OSImage is a suitable
797// container for the OSImage XML subtrees that are returned from the List OS
798// Images API call.
799func (suite *xmlSuite) TestOSImageWRTListOSImages(c *C) {
800 // From http://msdn.microsoft.com/en-us/library/windowsazure/jj157191.aspx
801 input := `
802 <OSImage xmlns="http://schemas.microsoft.com/windowsazure">
803 <AffinityGroup>name-of-the-affinity-group</AffinityGroup>
804 <Category>category-of-the-image</Category>
805 <Label>image-description</Label>
806 <Location>geo-location-of-the-stored-image</Location>
807 <LogicalSizeInGB>123.456</LogicalSizeInGB>
808 <MediaLink>url-of-the-containing-blob</MediaLink>
809 <Name>image-name</Name>
810 <OS>operating-system-of-the-image</OS>
811 <Eula>image-eula</Eula>
812 <Description>image-description</Description>
813 <ImageFamily>image-family</ImageFamily>
814 <ShowInGui>true|false</ShowInGui>
815 <PublishedDate>published-date</PublishedDate>
816 <IsPremium>true|false</IsPremium>
817 <PrivacyUri>uri-of-privacy-policy</PrivacyUri>
818 <RecommendedVMSize>size-of-the-virtual-machine</RecommendedVMSize>
819 <PublisherName>publisher-identifier</PublisherName>
820 <PricingDetailLink>pricing-details</PricingDetailLink>
821 <SmallIconUri>uri-of-icon</SmallIconUri>
822 <Language>language-of-image</Language>
823 </OSImage>
824 `
825 expected := &OSImage{
826 AffinityGroup: "name-of-the-affinity-group",
827 Category: "category-of-the-image",
828 Label: "image-description",
829 Location: "geo-location-of-the-stored-image",
830 LogicalSizeInGB: 123.456,
831 MediaLink: "url-of-the-containing-blob",
832 Name: "image-name",
833 OS: "operating-system-of-the-image",
834 EULA: "image-eula",
835 Description: "image-description",
836 ImageFamily: "image-family",
837 ShowInGUI: "true|false",
838 PublishedDate: "published-date",
839 IsPremium: "true|false",
840 PrivacyURI: "uri-of-privacy-policy",
841 RecommendedVMSize: "size-of-the-virtual-machine",
842 PublisherName: "publisher-identifier",
843 PricingDetailLink: "pricing-details",
844 SmallIconURI: "uri-of-icon",
845 Language: "language-of-image",
846 }
847
848 osimage := &OSImage{}
849 err := osimage.Deserialize([]byte(input))
850 c.Assert(err, IsNil)
851 c.Assert(osimage, DeepEquals, expected)
852}
853
854// TestOSImageWRTUpdateOSImage demonstrates the OSImage is a suitable
855// container for the OSImage XML trees that are required for the Update OS
856// Image API call.
857func (suite *xmlSuite) TestOSImageWRTUpdateOSImage(c *C) {
858 // From http://msdn.microsoft.com/en-us/library/windowsazure/jj157198.aspx
859 input := `
860 <OSImage xmlns="http://schemas.microsoft.com/windowsazure">
861 <Label>image-label</Label>
862 <Eula>image-eula</Eula>
863 <Description>Image-Description</Description>
864 <ImageFamily>Image-Family</ImageFamily>
865 <PublishedDate>published-date</PublishedDate>
866 <IsPremium>true/false</IsPremium>
867 <ShowInGui>true/false</ShowInGui>
868 <PrivacyUri>http://www.example.com/privacypolicy.html</PrivacyUri>
869 <IconUri>http://www.example.com/favicon.png</IconUri>
870 <RecommendedVMSize>Small/Large/Medium/ExtraLarge</RecommendedVMSize>
871 <SmallIconUri>http://www.example.com/smallfavicon.png</SmallIconUri>
872 <Language>language-of-image</Language>
873 </OSImage>
874 `
875 expected := &OSImage{
876 Label: "image-label",
877 EULA: "image-eula",
878 Description: "Image-Description",
879 ImageFamily: "Image-Family",
880 PublishedDate: "published-date",
881 IsPremium: "true/false",
882 ShowInGUI: "true/false",
883 PrivacyURI: "http://www.example.com/privacypolicy.html",
884 IconURI: "http://www.example.com/favicon.png",
885 RecommendedVMSize: "Small/Large/Medium/ExtraLarge",
886 SmallIconURI: "http://www.example.com/smallfavicon.png",
887 Language: "language-of-image",
888 }
889
890 osimage := &OSImage{}
891 err := osimage.Deserialize([]byte(input))
892 c.Assert(err, IsNil)
893 c.Assert(osimage, DeepEquals, expected)
894}
895
749func (suite *xmlSuite) TestOSImageHasLocation(c *C) {896func (suite *xmlSuite) TestOSImageHasLocation(c *C) {
750 image := &OSImage{897 image := &OSImage{
751 Location: "East Asia;Southeast Asia;North Europe;West Europe;East US;West US",898 Location: "East Asia;Southeast Asia;North Europe;West Europe;East US;West US",

Subscribers

People subscribed via source and target branches

to all changes: