#!/usr/bin/env python ############################################################################ # Joshua R. Boverhof, LBNL # See LBNLCopyright for copyright notice! ########################################################################### import sys, unittest from ServiceTest import main, ServiceTestCase, ServiceTestSuite, TestException from ZSI.schema import ElementDeclaration, GED from ZSI import ParsedSoap """ Unittest for contacting the Amazon ECommerce Service WSDL: """ # General targets def dispatch(): """Run all dispatch tests""" suite = ServiceTestSuite() suite.addTest(unittest.makeSuite(AmazonTestCase, 'test_dispatch')) return suite def local(): """Run all local tests""" suite = ServiceTestSuite() suite.addTest(unittest.makeSuite(AmazonTestCase, 'test_local')) return suite def net(): """Run all network tests""" suite = ServiceTestSuite() suite.addTest(unittest.makeSuite(AmazonTestCase, 'test_net')) return suite def all(): """Run all tests""" suite = ServiceTestSuite() suite.addTest(unittest.makeSuite(AmazonTestCase, 'test_')) return suite class AmazonTestCase(ServiceTestCase): """Test case for Amazon ECommerce Web service """ name = "test_AWSECommerceService" client_file_name = "AWSECommerceService_services.py" types_file_name = "AWSECommerceService_services_types.py" server_file_name = "AWSECommerceService_services_server.py" def __init__(self, methodName): ServiceTestCase.__init__(self, methodName) self.wsdl2py_args.append('-b') self.wsdl2py_args.append('--lazy') def test_local_bug_1525567(self): element = GED("http://webservices.amazon.com/AWSECommerceService/2006-09-18", 'Items') # Make sure this is a GED self.failUnless(isinstance(element, ElementDeclaration), '"%s" not a GED' %element) def test_local_parse_ItemSearch(self): msg = self.client_module.ItemSearchResponseMsg() ps = ParsedSoap(ItemSearchResponseMsg) response = ps.Parse(msg.typecode) response.OperationRequest.Arguments for i in response.OperationRequest.Arguments.Argument: i.get_attribute_Name() i.get_attribute_Value() for i in response.OperationRequest.HTTPHeaders.Header or []: i.get_attribute_Name() i.get_attribute_Value() response.OperationRequest.RequestId response.OperationRequest.RequestProcessingTime for its in response.Items: self.failUnless(its.TotalResults == 55, '') self.failUnless(its.TotalPages == 6, '') for it in its.Item: it.ASIN; it.Accessories; #it.AlternateVersions; it.BrowseNodes #it.Collections; it.CustomerReviews ;it.DetailPageURL it.EditorialReviews; it.Errors; it.ImageSets; it.ItemAttributes it.LargeImage; it.ListmaniaLists; it.MediumImage; it.MerchantItemAttributes it.OfferSummary; it.Offers; #it.ParentASIN; it.SalesRank; it.SearchInside it.SimilarProducts; it.SmallImage; it.Subjects; it.Tracks; def test_net_ItemSearch(self): loc = self.client_module.AWSECommerceServiceLocator() port = loc.getAWSECommerceServicePortType(**self.getPortKWArgs()) msg = self.client_module.ItemSearchRequestMsg() msg.SubscriptionId = '0HP1WHME000749APYWR2' request = msg.new_Request() msg.Request = [request] # request request.ItemPage = 1 request.SearchIndex = "Books" request.Keywords = 'Tamerlane' request.ResponseGroup = ['Medium',] response = port.ItemSearch(msg) response.OperationRequest self.failUnless(response.OperationRequest.Errors is None, 'ecommerce site reported errors') response.OperationRequest.Arguments for i in response.OperationRequest.Arguments.Argument: i.get_attribute_Name() i.get_attribute_Value() for i in response.OperationRequest.HTTPHeaders.Header or []: i.get_attribute_Name() i.get_attribute_Value() response.OperationRequest.RequestId response.OperationRequest.RequestProcessingTime for its in response.Items: for it in its.Item: it.ASIN; it.Accessories; #it.AlternateVersions; it.BrowseNodes #it.Collections; it.CustomerReviews ;it.DetailPageURL it.EditorialReviews; it.Errors; it.ImageSets; it.ItemAttributes it.LargeImage; it.ListmaniaLists; it.MediumImage; it.MerchantItemAttributes it.OfferSummary; it.Offers; #it.ParentASIN; it.SalesRank; it.SearchInside it.SimilarProducts; it.SmallImage; it.Subjects; it.Tracks; it.VariationSummary; it.Variations ItemSearchResponseMsg="""
1C167XDF9BX253MEYAF20.987805128097534
True1TamerlaneMediumBooks556030681465Xhttp://www.amazon.com/gp/redirect.html%3FASIN=030681465X%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/030681465X%253FSubscriptionId=0HP1WHME000749APYWR2135340http://images.amazon.com/images/P/030681465X.01._SCTHUMBZZZ_V66860320_.jpg7550http://images.amazon.com/images/P/030681465X.01._SCMZZZZZZZ_V66860320_.jpg160108http://images.amazon.com/images/P/030681465X.01._SCLZZZZZZZ_V66860320_.jpg500337http://images.amazon.com/images/P/030681465X.01._SCTHUMBZZZ_V66860320_.jpg7550http://images.amazon.com/images/P/030681465X.01._SCMZZZZZZZ_V66860320_.jpg160108http://images.amazon.com/images/P/030681465X.01._SCLZZZZZZZ_V66860320_.jpg500337Justin MarozziHardcover9209780306814655New Ed030681465X2695USD$26.95Da Capo Press1368150904174640Book2006-02-22Da Capo PressDa Capo PressTamerlane: Sword of Islam, Conqueror of the World831USD$8.31832USD$8.32432600Book DescriptionA powerful account of the life of Tamerlane the Great (1336-1405), the last great Mongol conqueror of Central Asia, ruler of a vast empire, and one of history's most brutal tyrants <P> Tamerlane, aka Temur-the Mongol successor to Genghis Khan-ranks with Alexander the Great as one of the world's great conquerors, yet the details of his life are scarcely known in the West. Born in obscurity and poverty, he rose to become a fierce tribal leader, and with that his dominion and power grew with astonishing speed. He blazed through Asia, razing cities to the ground. He tortured conquered inhabitants without mercy, sometimes ordering them buried alive, at other times decapitating them. Over the ruins of conquered Baghdad, Tamerlane had his soldiers erect a pyramid of 90,000 enemy heads. As he and his armies swept through Central Asia, sacking, and then rebuilding cities, Tamerlane gradually imposed an iron rule and a refined culture over a vast territory-from the steppes of Asia to the Syrian coastline. <P> Justin Marozzi traveled in the footsteps of this fearsome emperor of Samarkand (modern-day Uzbekistan) to write this book, which is part history, part travelogue. He carefully follows the path of this infamous and enigmatic conqueror, recounting the history and the story of this cruel, cultivated, and indomitable warrior.1853141046http://www.amazon.com/gp/redirect.html%3FASIN=1853141046%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/1853141046%253FSubscriptionId=0HP1WHME000749APYWR2366445David NicolleRichard HookHardcover950.20922978185314104118531410462495USD$24.95Firebird1208100075160775Book1990-09FirebirdFirebirdThe Mongol Warlords: Ghengis Khan, Kublai Khan, Hulegu, Tamerlane (Heroes & Warriors)1095USD$10.9503000521633842http://www.amazon.com/gp/redirect.html%3FASIN=0521633842%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/0521633842%253FSubscriptionId=0HP1WHME000749APYWR2429712http://images.amazon.com/images/P/0521633842.01._SCTHUMBZZZ_V1114821525_.jpg6039http://images.amazon.com/images/P/0521633842.01._SCMZZZZZZZ_V1114821525_.jpg14090http://images.amazon.com/images/P/0521633842.01._SCLZZZZZZZ_V1114821525_.jpg475306http://images.amazon.com/images/P/0521633842.01._SCTHUMBZZZ_V1114821525_.jpg6039http://images.amazon.com/images/P/0521633842.01._SCMZZZZZZZ_V1114821525_.jpg14090http://images.amazon.com/images/P/0521633842.01._SCLZZZZZZZ_V1114821525_.jpg475306Beatrice Forbes ManzPaperback950.29780521633840Reprint05216338422299USD$22.99Cambridge University Press12466785074562Book1999-03-28Cambridge University PressCambridge University PressThe Rise and Rule of Tamerlane (Canto original series)1298USD$12.981054USD$10.542299USD$22.99252110Book DescriptionThis is the first serious study of Tamerlane, the great nomad conqueror who rose to power in 1370 on the ruins of the Mongol Empire and led his armies on campaigns of unprecedented scope, ranging from Moscow to Delhi. As the last nomad ruler to unite the steppe regions of Eurasia, Tamerlane marks the transition from the era of nomad conquest and rule to the modern ascendency of the settled world.1885221770http://www.amazon.com/gp/redirect.html%3FASIN=1885221770%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/1885221770%253FSubscriptionId=0HP1WHME000749APYWR2474520http://images.amazon.com/images/P/1885221770.01._SCTHUMBZZZ_V1056534986_.jpg6040http://images.amazon.com/images/P/1885221770.01._SCMZZZZZZZ_V1056534986_.jpg14093http://images.amazon.com/images/P/1885221770.01._SCLZZZZZZZ_V1056534986_.jpg475317http://images.amazon.com/images/P/1885221770.01._SCTHUMBZZZ_V1056534986_.jpg6040http://images.amazon.com/images/P/1885221770.01._SCMZZZZZZZ_V1056534986_.jpg14093http://images.amazon.com/images/P/1885221770.01._SCLZZZZZZZ_V1056534986_.jpg475317Roy StierPaperback978188522177318852217701695USD$16.95Bookpartners13047990092606Book1998-09BookpartnersBookpartnersTamerlane: The Ultimate Warrior975USD$9.752295USD$22.950310Book DescriptionFrom humble beginnings, Tamerlane, the ancient Turki-Mongol conqueror, rose to become the scourge of his time and changed the course of history. <P>The name Tamerlane runs the gamut of human emotions, evoking in many a revulsion for the devil incarnate, in others, an appreciation for the benefactor of millions. <P>By using accounts from Tamerlane's detractors and his admirers, Roy Stier has captured an amazing story that gives credence to the old adage, "truth is stranger than fiction." <P>Tamerlane, the Ultimate Warrior is presented as a fascinating series of events and captures the reader in the first comprehensive view of this historical figure who dominated Asia and made Europe tremble.0850459494http://www.amazon.com/gp/redirect.html%3FASIN=0850459494%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/0850459494%253FSubscriptionId=0HP1WHME000749APYWR2480359http://images.amazon.com/images/P/0850459494.01._SCTHUMBZZZ_V1128022797_.jpg7556http://images.amazon.com/images/P/0850459494.01._SCMZZZZZZZ_V1128022797_.jpg160119http://images.amazon.com/images/P/0850459494.01._SCLZZZZZZZ_V1128022797_.jpg500372http://images.amazon.com/images/P/0850459494.01._SCTHUMBZZZ_V1128022797_.jpg7556http://images.amazon.com/images/P/0850459494.01._SCMZZZZZZZ_V1128022797_.jpg160119http://images.amazon.com/images/P/0850459494.01._SCLZZZZZZZ_V1128022797_.jpg500372David NicollePaperbackAngus Mcbride978085045949408504594941595USD$15.95Osprey Publishing1481597836722Book1990-07-26Osprey Publishing1990-07-26Osprey PublishingThe Age of Tamerlane (Men-at-Arms)920USD$9.20815USD$8.1512900Book DescriptionTamerlane or Timur-i-Lenk ('Timur the Lame') is one of the most extraordinary conquerors in history. In the late 14th century his armies seized huge territories from the borders of Mongolia to Palestine and Anatolia. His passage was marked by massacres that outdid even those of the Mongols for sheer savagery. Timur's career was unequalled since Alexander the Great in terms of constant battlefield success. Only in his youth, while recovering his family estates south of Samarqand, did he face occasional defeat. This title tells the remarkable story of Timur and details the organisation, tactics, arms and armour of his all-conquering army.1851684573http://www.amazon.com/gp/redirect.html%3FASIN=1851684573%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/1851684573%253FSubscriptionId=0HP1WHME000749APYWR2600493http://images.amazon.com/images/P/1851684573.01._SCTHUMBZZZ_V63318467_.jpg7549http://images.amazon.com/images/P/1851684573.01._SCMZZZZZZZ_V63318467_.jpg160104http://images.amazon.com/images/P/1851684573.01._SCLZZZZZZZ_V63318467_.jpg500324http://images.amazon.com/images/P/1851684573.01._SCTHUMBZZZ_V63318467_.jpg7549http://images.amazon.com/images/P/1851684573.01._SCMZZZZZZZ_V63318467_.jpg160104http://images.amazon.com/images/P/1851684573.01._SCLZZZZZZZ_V63318467_.jpg500324Robert RandPaperback320978185168457118516845731495USD$14.95Oneworld Publications12246678454512Book2006-09-11Oneworld PublicationsOneworld PublicationsTamerlane's Children: Dispatches from Contemporary Uzbekistan915USD$9.15950USD$9.5031600Book DescriptionIn the central park of Tashkent, in a place the Uzbeks call the square, a magnificent statue of a mounted warrior dominates the surroundings - Tamerlane - national hero of post-Soviet Uzbekistan. And yet how does this 14th century conqueror reflect one of the world's most diverse and politically intriguing countries?Having spent three years in the region, renowned journalist Robert Rand seeks to answer this question, covering an assortment of fascinating topics, ranging from the effect of 9/11 to the clash of culture in Uzbek pop music. Overflowing with charming anecdotes and loveable personalities, Rand gives the reader a real sense of the country's confused identity and the challenges which it and its people will face in generations to come.B000GKT9AQhttp://www.amazon.com/gp/redirect.html%3FASIN=B000GKT9AQ%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/B000GKT9AQ%253FSubscriptionId=0HP1WHME000749APYWR2619234Harold LambHardcoverGarden City, N.Y., U.S.A.: Doubleday & Company, Inc.BookBOOKS_1973_AND_LATER1941Garden City, N.Y., U.S.A.: Doubleday & Company, Inc.Garden City, N.Y., U.S.A.: Doubleday & Company, Inc.Earth Shakers: The: The March of the Barbarians and Tamerlane850USD$8.500200B00087SKA2http://www.amazon.com/gp/redirect.html%3FASIN=B00087SKA2%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/B00087SKA2%253FSubscriptionId=0HP1WHME000749APYWR2855185Harold LambUnknown BindingBantam Books216Book1955Bantam BooksBantam BooksTamerlane: Conqueror of the earth650USD$6.5005000689304463http://www.amazon.com/gp/redirect.html%3FASIN=0689304463%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/0689304463%253FSubscriptionId=0HP1WHME000749APYWR21028876Barbara CorcoranHardcoverCharles Robinson9780689304460[1st ed.]0689304463695USD$6.95Macmillan Pub Co1152Book1975-02Macmillan Pub CoYoung AdultMacmillan Pub CoMeet Me at Tamerlane's Tomb30USD$0.301000USD$10.0002020
""" if __name__ == '__main__': main()