Skip to content

Commit 2c9d994

Browse files
committed
fixed refactor bug
1 parent b6a0423 commit 2c9d994

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

ellar_throttler/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def setup(
2929
IThrottlerStorage, use_class=ThrottlerStorageService
3030
)
3131

32-
return DynamicModule( # type: ignore
32+
return DynamicModule(
3333
cls,
3434
providers=[
3535
_provider,

ellar_throttler/throttler_guard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
from ellar.core import GuardCanActivate, IExecutionContext, Response
55
from ellar.core.connection import HTTPConnection
6+
from ellar.core.services import Reflector
67
from ellar.di import injectable
78
from ellar.helper import get_name
8-
from ellar.services import Reflector
99

1010
from .constants import THROTTLER_LIMIT, THROTTLER_SKIP, THROTTLER_TTL
1111
from .exception import ThrottledException

ellar_throttler/throttler_module_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import typing as t
22

33
from ellar.core import IExecutionContext
4-
from ellar.serializer import Serializer
4+
from ellar.core.serializer import Serializer
55

66

77
class ThrottlerModuleOptions(Serializer):

ellar_throttler/throttler_storage_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ellar.serializer import Serializer
1+
from ellar.core.serializer import Serializer
22

33

44
class ThrottlerStorageOption(Serializer):

ellar_throttler/throttler_storage_record.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ellar.serializer import Serializer
1+
from ellar.core.serializer import Serializer
22

33

44
class ThrottlerStorageRecord(Serializer):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ classifiers = [
4141
]
4242

4343
dependencies = [
44-
"ellar >= 0.3.4"
44+
"ellar == 0.3.6"
4545
]
4646

4747

tests/test_throttler.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from app.server import app
66
from ellar.cache import CacheModule
77
from ellar.cache.backends.local_cache import LocalMemCacheBackend
8-
from ellar.core import TestClient, TestClientFactory
8+
from ellar.testing import Test, TestClient
99

1010
from ellar_throttler import (
1111
CacheThrottlerStorageService,
@@ -85,15 +85,15 @@ def test_default_controller_index(self):
8585

8686
class TestSkipIfConfigure:
8787
def test_skip_configure(self):
88-
test_module = TestClientFactory.create_test_module(
88+
test_module = Test.create_test_module(
8989
modules=(
9090
ThrottlerModule.setup(limit=5, ttl=100, skip_if=lambda ctx: True),
9191
ControllerModule,
9292
),
9393
global_guards=[ThrottlerGuard],
9494
)
9595

96-
_client = test_module.get_client()
96+
_client = test_module.get_test_client()
9797
for i in range(15):
9898
res = _client.get("/")
9999

@@ -106,7 +106,7 @@ def test_skip_configure(self):
106106

107107

108108
class TestThrottlerStorageServiceConfiguration:
109-
test_module_cache = TestClientFactory.create_test_module(
109+
test_module_cache = Test.create_test_module(
110110
modules=(
111111
ThrottlerModule.setup(
112112
limit=5, ttl=100, storage=CacheThrottlerStorageService
@@ -118,7 +118,7 @@ class TestThrottlerStorageServiceConfiguration:
118118
config_module=dict(CACHES={"default": LocalMemCacheBackend()}),
119119
)
120120

121-
test_module_use_value = TestClientFactory.create_test_module(
121+
test_module_use_value = Test.create_test_module(
122122
modules=(
123123
ThrottlerModule.setup(limit=5, ttl=100, storage=ThrottlerStorageService()),
124124
ControllerModule,
@@ -138,7 +138,7 @@ def request_for_limit(self, app_client, url, limit):
138138

139139
@pytest.mark.parametrize("test_module", [test_module_cache, test_module_use_value])
140140
def test_limit_index(self, test_module):
141-
_client = test_module.get_client()
141+
_client = test_module.get_test_client()
142142

143143
for url, limit in [("/limit/", 2), ("/limit/higher", 5)]:
144144
self.request_for_limit(_client, url, limit)
@@ -151,7 +151,7 @@ def test_limit_index(self, test_module):
151151

152152
@pytest.mark.parametrize("test_module", [test_module_cache, test_module_use_value])
153153
def test_limit_get_shorter(self, test_module):
154-
_client = test_module.get_client()
154+
_client = test_module.get_test_client()
155155
limit, url = (
156156
5,
157157
"/limit/shorter",
@@ -167,7 +167,7 @@ def test_limit_get_shorter(self, test_module):
167167

168168
@pytest.mark.parametrize("test_module", [test_module_use_value])
169169
def test_limit_get_shorter_cache_clear(self, test_module):
170-
_client = test_module.get_client()
170+
_client = test_module.get_test_client()
171171
limit, url = (
172172
5,
173173
"/limit/shorter-2",

0 commit comments

Comments
 (0)