test(backend): 覆盖注册限流缺省回退
This commit is contained in:
1 parent
56300754b3
commit
f4003edc58
1 file changed
+11
@@ -204,6 +204,17 @@ class AppAuthServiceTest {
|
|||||||
.hasMessageContaining("当前网络注册过于频繁");
|
.hasMessageContaining("当前网络注册过于频繁");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_fallback_to_default_limit_when_config_is_missing() {
|
||||||
|
given(userMapper.selectCount(any())).willReturn(5L);
|
||||||
|
|
||||||
|
assertThatThrownBy(() -> authService.register(emailRegister("abcd1234", null), "203.0.113.8"))
|
||||||
|
.isInstanceOf(ServiceException.class)
|
||||||
|
.satisfies(ex -> assertThat(((ServiceException) ex).getCode())
|
||||||
|
.isEqualTo(ErrorCode.TOO_MANY_REQUESTS.getCode()))
|
||||||
|
.hasMessageContaining("当前网络注册过于频繁");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_not_limit_by_ip_when_ip_limit_is_zero() {
|
void should_not_limit_by_ip_when_ip_limit_is_zero() {
|
||||||
stubHappyRegister();
|
stubHappyRegister();
|
||||||
|
|||||||
Reference in new issue
Block a user