Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5330845

Browse files
committed
Fix tests
1 parent 442f602 commit 5330845

3 files changed

Lines changed: 8 additions & 17 deletions

File tree

changes/7350.removal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``ckan.route_after_login`` renamed to ``ckan.auth.route_after_login``

ckan/tests/config/declaration/test_declaration.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22

3-
import logging
43
from ckan.common import CKANConfig
54
from ckan.config.declaration.load import GroupV1, OptionV1
65
import pytest
@@ -160,25 +159,16 @@ def test_normalize_convert_types(self):
160159
decl.normalize(cfg)
161160
assert cfg == CKANConfig({"a": 20})
162161

163-
@pytest.mark.parametrize("raw,safe,warned", [
164-
({}, {"a": "default"}, False),
165-
({"legacy_a": "legacy"}, {"a": "legacy", "legacy_a": "legacy"}, True),
166-
({"a": "modern", "legacy_a": "legacy"}, {"a": "modern", "legacy_a": "legacy"}, False),
162+
@pytest.mark.parametrize("raw,safe", [
163+
({}, {"a": "default"}),
164+
({"legacy_a": "legacy"}, {"a": "legacy", "legacy_a": "legacy"}),
165+
({"a": "modern", "legacy_a": "legacy"}, {"a": "modern", "legacy_a": "legacy"}),
167166
])
168-
def test_legacy_key(self, raw, safe, warned, caplog):
167+
def test_legacy_key(self, raw, safe):
169168
decl = Declaration()
170169
option = decl.declare(Key().a, "default")
171170
option.legacy_key = "legacy_a"
172171

173172
cfg = CKANConfig(raw)
174-
with caplog.at_level(logging.WARNING):
175-
decl.make_safe(cfg)
176-
177-
if warned:
178-
assert caplog.records
179-
assert "legacy_a" in caplog.records[0].message
180-
181-
else:
182-
assert not caplog.records
183-
173+
decl.make_safe(cfg)
184174
assert cfg == CKANConfig(safe)

ckan/views/user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def index():
137137

138138
def me() -> Response:
139139
return h.redirect_to(
140-
config.get(u'ckan.route_after_login'))
140+
config.get(u'ckan.auth.route_after_login'))
141141

142142

143143
def read(id: str) -> Union[Response, str]:

0 commit comments

Comments
 (0)