-
Notifications
You must be signed in to change notification settings - Fork 0
/
redirect_test.go
58 lines (53 loc) · 4.02 KB
/
redirect_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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"testing"
)
func TestMapUrlSimple(t *testing.T) {
m := map[string]string{
"": "https://docs.djangoproject.com/ja/3.1/",
"/": "https://docs.djangoproject.com/ja/3.1/",
"/favicon.ico": "https://docs.djangoproject.com/ja/3.1/",
"/en/latest/faq/": "https://docs.djangoproject.com/ja/3.1/faq/",
"/ja/latest/faq/": "https://docs.djangoproject.com/ja/3.1/",
"/en/latest/contents.html": "https://docs.djangoproject.com/ja/3.1/contents/",
"/en/latest/_sources/ref/forms/fields.txt": "https://docs.djangoproject.com/ja/3.1/ref/forms/fields/",
}
for k, v := range m {
if r := mapUrl(k); r != v {
t.Errorf("mapUrl(%q) is expected: %q, but actually %q", k, v, r)
}
}
}
func TestMapUrlMigration(t *testing.T) {
m := map[string]string{
"/en/latest/howto/apache-auth.html": "https://docs.djangoproject.com/ja/3.1/howto/deployment/wsgi/apache-auth/",
"/en/latest/howto/deployment/fastcgi.html": "https://docs.djangoproject.com/ja/3.1/internals/deprecation/#deprecation-removed-in-1-9",
"/en/latest/howto/deployment/modpython.html": "https://docs.djangoproject.com/ja/3.1/internals/deprecation/#deprecation-removed-in-1-5",
"/en/latest/internals/committers.html": "https://docs.djangoproject.com/ja/3.1/internals/organization/#prerogatives",
"/en/latest/internals/documentation.html": "https://docs.djangoproject.com/ja/3.1/internals/contributing/writing-documentation/",
"/en/latest/obsolete/": "https://docs.djangoproject.com/ja/3.1/internals/deprecation/",
"/en/latest/obsolete/admin-css.html": "https://docs.djangoproject.com/ja/3.1/internals/deprecation/",
"/en/latest/ref/authbackends.html": "https://docs.djangoproject.com/ja/3.1/topics/auth/customizing/#authentication-backends",
"/en/latest/ref/contrib/comments/": "https://docs.djangoproject.com/ja/3.1/releases/1.8/#features-removed-in-1-8",
"/en/latest/ref/contrib/comments/custom.html": "https://docs.djangoproject.com/ja/3.1/releases/1.8/#features-removed-in-1-8",
"/en/latest/ref/contrib/csrf.html": "https://docs.djangoproject.com/ja/3.1/ref/csrf/",
"/en/latest/ref/contrib/databrowse.html": "https://docs.djangoproject.com/ja/3.1/releases/1.4/#django-contrib-databrowse",
"/en/latest/ref/contrib/formtools/": "https://docs.djangoproject.com/ja/3.1/releases/1.8/#removal-of-django-contrib-formtools",
"/en/latest/ref/contrib/formtools/form-preview.html": "https://docs.djangoproject.com/ja/3.1/releases/1.8/#removal-of-django-contrib-formtools",
"/en/latest/ref/contrib/localflavor.html": "https://docs.djangoproject.com/ja/3.1/internals/deprecation/#deprecation-removed-in-1-6",
"/en/latest/ref/contrib/webdesign.html": "https://docs.djangoproject.com/ja/3.1/releases/1.8/#django-contrib-webdesign",
"/en/latest/ref/generic-views.html": "https://docs.djangoproject.com/ja/3.1/topics/class-based-views/",
"/en/latest/topics/generic-views-migration.html": "https://docs.djangoproject.com/ja/3.1/topics/class-based-views/",
"/en/latest/topics/http/generic-views.html": "https://docs.djangoproject.com/ja/3.1/topics/class-based-views/",
"/en/latest/topics/generic-views.html": "https://docs.djangoproject.com/ja/3.1/topics/class-based-views/",
"/en/latest/releases/1.0-alpha-1.html": "https://docs.djangoproject.com/ja/3.1/releases/1.0/",
"/en/latest/releases/1.0-alpha-2.html": "https://docs.djangoproject.com/ja/3.1/releases/1.0/",
"/en/latest/releases/1.0-beta.html": "https://docs.djangoproject.com/ja/3.1/releases/1.0/",
"/en/latest/releases/1.1-alpha-1.html": "https://docs.djangoproject.com/ja/3.1/releases/1.1/",
}
for k, v := range m {
if r := mapUrl(k); r != v {
t.Errorf("mapUrl(%q) is expected with migration: %q, but actually %q", k, v, r)
}
}
}