小编Aye*_*ghe的帖子

toBeInTheDocument() 和 toBeVisible() 有什么区别?

在 React 测试库中,我们有两个函数,称为toBeInTheDocument()toBeVisible()

1 expect(screen.getByText('hello')).toBeInTheDocument();
2 expect(screen.getByText('hello')).toBeVisible();
Run Code Online (Sandbox Code Playgroud)

看来这两个断言的行为是相同的。它们有什么区别,各自的用例是什么?

unit-testing jestjs react-testing-library

27
推荐指数
1
解决办法
3万
查看次数

如何在烧瓶上确保REST Api

我需要在我的应用程序上开发Rest API(基于Flask)

但我真的不知道应该如何保护它.

目前,我对来自浏览器的用户进行了正常的身份验证.(使用会话等)

但对于API用户,我应该在每个API请求时询问用户名/密码吗?它真的安全吗?我知道很多web API都使用令牌进行API调用,这是最好的方法吗?

在这种情况下,如何实现它?(这不是我的专业领域..)非常感谢

security api rest flask

5
推荐指数
1
解决办法
9608
查看次数

如何重启普罗米修斯?

我已经在我的 Ubuntu 机器上设置了 prometheus 并且它现在正在运行localhost:9090。但是,当我运行以下命令时,我得到失败状态。

\n\n
systemctl status prometheus\n
Run Code Online (Sandbox Code Playgroud)\n\n

输出:

\n\n
\xe2\x97\x8f prometheus.service - Prometheus\nLoaded: loaded (/lib/systemd/system/prometheus.service; enabled; vendor preset: enabled)\nActive: failed (Result: exit-code) since Wed 2019-11-06 14:58:36 +0530; 8s ago\nMain PID: 7046 (code=exited, status=1/FAILURE)\n\n\xe0\xb6\xb1\xe0\xb7\x99\xe0\xb7\x80\xe0\xb7\x90 06 14:58:36 ayesh systemd[1]: prometheus.service: Service hold-off time over, scheduling restart\n\xe0\xb6\xb1\xe0\xb7\x99\xe0\xb7\x80\xe0\xb7\x90 06 14:58:36 ayesh systemd[1]: prometheus.service: Scheduled restart job, restart counter is at 5\n\xe0\xb6\xb1\xe0\xb7\x99\xe0\xb7\x80\xe0\xb7\x90 06 14:58:36 ayesh systemd[1]: Stopped Prometheus.\n\xe0\xb6\xb1\xe0\xb7\x99\xe0\xb7\x80\xe0\xb7\x90 06 14:58:36 ayesh systemd[1]: prometheus.service: Start request repeated too quickly.\n\xe0\xb6\xb1\xe0\xb7\x99\xe0\xb7\x80\xe0\xb7\x90 06 14:58:36 …
Run Code Online (Sandbox Code Playgroud)

config restart prometheus

5
推荐指数
1
解决办法
3万
查看次数