2929from commoncode .testcase import FileBasedTesting
3030
3131from packagedcode import nuget
32+ from collections import OrderedDict
3233
3334
3435class TestNuget (FileBasedTesting ):
3536 test_data_dir = os .path .join (os .path .dirname (__file__ ), 'data' )
3637
3738 def test_parse_nuspec_bootstrap (self ):
3839 test_file = self .get_test_loc ('nuget/bootstrap.nuspec' )
39- output_obtained = nuget .parse_nuspec (test_file )
40- expected_output = {
40+ result = nuget .parse_nuspec (test_file )
41+ expected = {
4142 'authors' : u'Twitter, Inc.' ,
4243 'copyright' : u'Copyright 2015' ,
4344 'description' : u'The most popular front-end framework for developing responsive, mobile first projects on the web.' ,
@@ -51,7 +52,7 @@ def test_parse_nuspec_bootstrap(self):
5152 'title' : u'Bootstrap CSS' ,
5253 'version' : u'4.0.0-alpha'
5354 }
54- assert expected_output == output_obtained
55+ assert expected == result
5556
5657 def test_parse_nuspec_entity_framework (self ):
5758 test_file = self .get_test_loc ('nuget/EntityFramework.nuspec' )
@@ -106,11 +107,34 @@ def test_parse_nuspec_microsoft_asp_mvc(self):
106107 def test_parse_creates_package_from_nuspec (self ):
107108 test_file = self .get_test_loc ('nuget/Microsoft.Net.Http.nuspec' )
108109 package = nuget .parse (test_file )
109- assert 'Microsoft.Net.Http' == package .name
110- assert 'Microsoft.Net.Http' == package .id
111- assert [u'Copyright \xa9 Microsoft Corporation' ] == package .copyrights
112- assert '2.2.29' == package .version
113- assert 'http://go.microsoft.com/fwlink/?LinkID=280055' == package .homepage_url
114- assert 'Microsoft HTTP Client Libraries' == package .summary
115- assert 'Microsoft' == package .authors
116- assert 'Microsoft' == package .owners
110+ expected = OrderedDict ([
111+ ('type' , u'Nuget' ),
112+ ('name' , u'Microsoft.Net.Http' ),
113+ ('version' , u'2.2.29' ),
114+ ('primary_language' , None ),
115+ ('packaging' , u'archive' ),
116+ ('summary' , u'Microsoft HTTP Client Libraries' ),
117+ ('description' , u'This package includes HttpClient for sending requests over HTTP, as well as HttpRequestMessage and HttpResponseMessage for '
118+ u'processing HTTP messages.\n \n This package is not supported in Visual Studio 2010, and is only required for projects targeting'
119+ u' .NET Framework 4.5, Windows 8, or Windows Phone 8.1 when consuming a library that uses this package.\n \n Supported Platforms:'
120+ u'\n - .NET Framework 4\n - Windows 8\n - Windows Phone 8.1\n - Windows Phone Silverlight 7.5\n - Silverlight 4\n - Portable Class Libraries' ),
121+ ('payload_type' , None ),
122+ ('authors' , [OrderedDict ([('type' , None ), ('name' , u'Microsoft' ), ('email' , None ), ('url' , None )])]),
123+ ('maintainers' , []), ('contributors' , []),
124+ ('owners' , [OrderedDict ([('type' , None ), ('name' , u'Microsoft' ), ('email' , None ), ('url' , None )])]),
125+ ('packagers' , []), ('distributors' , []), ('vendors' , []),
126+ ('keywords' , []), ('keywords_doc_url' , None ),
127+ ('metafile_locations' , []),
128+ ('metafile_urls' , []),
129+ ('homepage_url' , u'http://go.microsoft.com/fwlink/?LinkID=280055' ),
130+ ('notes' , None ), ('download_urls' , []),
131+ ('download_sha1' , None ), ('download_sha256' , None ), ('download_md5' , None ),
132+ ('bug_tracking_url' , None ), ('support_contacts' , []), ('code_view_url' , None ),
133+ ('vcs_tool' , None ), ('vcs_repository' , None ), ('vcs_revision' , None ),
134+ ('copyright_top_level' , None ), ('copyrights' , [u'Copyright \xa9 Microsoft Corporation' ]),
135+ ('asserted_licenses' , [OrderedDict ([('license' , None ), ('url' , u'http://go.microsoft.com/fwlink/?LinkId=329770' ), ('text' , None ), ('notice' , None )])]),
136+ ('legal_file_locations' , []), ('license_expression' , None ), ('license_texts' , []), ('notice_texts' , []),
137+ ('dependencies' , {}), ('related_packages' , [])])
138+
139+
140+ assert expected == package .as_dict ()
0 commit comments