forked from msf/go-minipypi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pypiisms_test.go
33 lines (28 loc) · 1006 Bytes
/
pypiisms_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import "testing"
func TestNameNormalize(t *testing.T) {
testNames := func(orig, target string) {
name := normalizeFileName(orig)
if name != target {
t.Errorf("name should be %v, but is: %v", target, name)
}
}
testNames("PyCrypto", "pycrypto")
testNames("Django-HStore", "django-hstore")
testNames("django_nose", "django-nose")
testNames("imposm.parser", "imposm-parser")
}
func TestPackageUrlPathToGetFilePath(t *testing.T) {
origPath := "/python-dateutil/python_dateutil-2.4.2-py2.py3-none-any.whl"
wanted := "/python_dateutil-2.4.2-py2.py3-none-any.whl"
path := handlePypiFileNames(origPath)
if path != wanted {
t.Errorf("failed to convert filename, wanted: %v, got: %v", wanted, path)
}
origPath = "/imposm-parser/imposm.parser-1.0.6-cp27-none-linux_x86_64.whl"
wanted = "/imposm.parser-1.0.6-cp27-none-linux_x86_64.whl"
path = handlePypiFileNames(origPath)
if path != wanted {
t.Errorf("failed to convert filename, wanted: %v, got: %v", wanted, path)
}
}