def test_path_to_url(self):
        # Test remote path
        indict = {'path': 'http://www.somewhere.com/data.csv'}
        out = converter.resource(indict)
        assert out['url'] == indict['path']

        # Test local path
        indict = {'path': './data.csv'}
        out = converter.resource(indict)
        assert out['url'] == indict['path']

        # Test POSIX path
        indict = {'path': '/home/user/data.csv'}
        out = converter.resource(indict)
        assert out['url'] == indict['path']
 def test_passthrough(self):
     indict = {
         'description': 'GDPs list',
         'format': 'CSV',
         'hash': 'e785c0883d7a104330e69aee73d4f235'
     }
     out = converter.resource(indict)
     assert out == indict
 def test_non_ckan_keys_passthrough(self):
     indict = {
         'title_cn': u'國內生產總值',
         'years': [2015, 2016],
         'last_year': 2016,
         'location': {
             'country': 'China'
         }
     }
     out = converter.resource(indict)
     exp = {
         'title_cn': u'國內生產總值',
         'years': [2015, 2016],
         'last_year': 2016,
         'location': {
             'country': 'China'
         }
     }
     assert out == exp
 def test_other_remapping(self):
     indict = {'bytes': 10, 'mediatype': 'text/csv'}
     exp = {'size': 10, 'mimetype': 'text/csv'}
     out = converter.resource(indict)
     assert out == exp