Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nginx-redirector
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
nginx-redirector
Commits
2edcd3c4
Commit
2edcd3c4
authored
Jul 14, 2020
by
Давид Добряков
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test files
parent
11199458
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
1 deletion
+53
-1
test.conf
redirector/tests/nginx/location-includes/test.conf
+14
-0
test.map
redirector/tests/nginx/maps/test.map
+8
-0
test_permanent_options.map
redirector/tests/nginx/maps/test_permanent_options.map
+4
-0
test_rewrite_options.map
redirector/tests/nginx/maps/test_rewrite_options.map
+4
-0
test_status=301_options.map
redirector/tests/nginx/maps/test_status=301_options.map
+4
-0
redirector_test.py
redirector/tests/redirector_test.py
+8
-1
test.ini
redirector/tests/test.ini
+5
-0
setup.py
setup.py
+6
-0
No files found.
redirector/tests/nginx/location-includes/test.conf
0 → 100644
View file @
2edcd3c4
if
($
test_redirect
) {
rewrite
^/
test
/(.*)$ $
test_redirect
break
;
}
if
($
test_rewrite_redirect
) {
rewrite
^/
test
/(.*)$ $
test_rewrite_redirect
break
;
return
rewrite
;
}
if
($
test_status
=
301
_
redirect
) {
rewrite
^/
test
/(.*)$ $
test_status
=
301
_
redirect
break
;
return
status
=
301
;
}
if
($
test_permanent_redirect
) {
rewrite
^/
test
/(.*)$ $
test_permanent_redirect
permanent
;
}
redirector/tests/nginx/maps/test.map
0 → 100644
View file @
2edcd3c4
map $uri $test_redirect {
/test/some-page /test/another-page;
/test/old-page /test/new-page;
/test/very-old-page /test/very-new-page;
~/test^assets/(.+) /test/new-assets/$1;
/test/some-page /other-project/some-page;
}
\ No newline at end of file
redirector/tests/nginx/maps/test_permanent_options.map
0 → 100644
View file @
2edcd3c4
map $uri $test_permanent_redirect {
/test/special-project https://github.com/etersoft/special-project;
}
\ No newline at end of file
redirector/tests/nginx/maps/test_rewrite_options.map
0 → 100644
View file @
2edcd3c4
map $uri $test_rewrite_redirect {
/test/categories /test/categories;
}
\ No newline at end of file
redirector/tests/nginx/maps/test_status=301_options.map
0 → 100644
View file @
2edcd3c4
map $uri $test_status=301_redirect {
/test/article-123.html /test/articles/123;
}
\ No newline at end of file
redirector/tests/redirector_test.py
View file @
2edcd3c4
import
unittest
from
redirector.tests.utils
import
get_abs_path
from
redirector.conf.config
import
Config
from
redirector.redirector
import
*
...
...
@@ -9,6 +11,11 @@ class EqualRedirectorTest(unittest.TestCase):
self
.
redirector
=
Redirector
()
def
test_equal_map
(
self
):
config
=
Config
()
abs_config_path
=
get_abs_path
(
'test.ini'
)
config
.
read_config
(
abs_config_path
)
abs_yaml_path
=
get_abs_path
(
'test.yaml'
)
abs_test_path
=
get_abs_path
(
'test.map'
)
redirector/tests/test.ini
0 → 100644
View file @
2edcd3c4
[DEFAULT]
nginx_dir
=
'/home/kantegory/pvt/nginx-redirector/tests/nginx'
maps_dir
=
%(nginx_dir)s/maps
config_dir
=
%(nginx_dir)s/location-includes
setup.py
View file @
2edcd3c4
...
...
@@ -21,6 +21,12 @@ classifiers_list = [
setup
(
name
=
const
.
NAME
,
version
=
"0.1.1"
,
description
=
"CLI-utility for building nginx redirects"
,
long_description
=
open
(
'README.md'
)
.
read
(),
author
=
"Nikita Efremov, Dobryakov David"
,
author_email
=
"kantegory@etersoft.ru"
,
url
=
"https://gitlab.eterfund.ru/eterfund/nginx-redirector/tree/dev-enhancement"
,
license
=
"ISC"
,
packages
=
[
'redirector'
,
'redirector.utils'
,
'redirector.tests'
,
'redirector.conf'
],
entry_points
=
{
'console_scripts'
:
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment