Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/npm/tests/test_utils.py
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | def test_extract_npm_package_author(self): | ||||
self.assertEqual( | self.assertEqual( | ||||
extract_npm_package_author(package_json), | extract_npm_package_author(package_json), | ||||
{ | { | ||||
'fullname': b'Shawn Walsh', | 'fullname': b'Shawn Walsh', | ||||
'name': b'Shawn Walsh', | 'name': b'Shawn Walsh', | ||||
'email': None | 'email': None | ||||
} | } | ||||
) | ) | ||||
package_json = json.loads(''' | |||||
{ | |||||
"name": "yfe-ynpm", | |||||
"version": "1.0.0", | |||||
"homepage": "http://gitlab.ywwl.com/yfe/yfe-ynpm", | |||||
"repository": { | |||||
"type": "git", | |||||
"url": "git@gitlab.ywwl.com:yfe/yfe-ynpm.git" | |||||
}, | |||||
"author": [ | |||||
"fengmk2 <fengmk2@gmail.com> (https://fengmk2.com)", | |||||
"xufuzi <xufuzi@ywwl.com> (https://7993.org)" | |||||
], | |||||
"license": "MIT" | |||||
}''') | |||||
self.assertEqual( | |||||
extract_npm_package_author(package_json), | |||||
{ | |||||
'fullname': b'fengmk2 <fengmk2@gmail.com>', | |||||
'name': b'fengmk2', | |||||
'email': b'fengmk2@gmail.com' | |||||
} | |||||
) | |||||
package_json = json.loads(''' | |||||
{ | |||||
"name": "umi-plugin-whale", | |||||
"version": "0.0.8", | |||||
"description": "Internal contract component", | |||||
"authors": { | |||||
"name": "xiaohuoni", | |||||
"email": "448627663@qq.com" | |||||
}, | |||||
"repository": "alitajs/whale", | |||||
"devDependencies": { | |||||
"np": "^3.0.4", | |||||
"umi-tools": "*" | |||||
}, | |||||
"license": "MIT" | |||||
}''') | |||||
self.assertEqual( | |||||
extract_npm_package_author(package_json), | |||||
{ | |||||
'fullname': b'xiaohuoni <448627663@qq.com>', | |||||
'name': b'xiaohuoni', | |||||
'email': b'448627663@qq.com' | |||||
} | |||||
) |