forked from DGNum/uptime-kuma-api
login by token in tests to fix the rate limit issue
This commit is contained in:
parent
624c16c4a6
commit
655e71d487
1 changed files with 15 additions and 5 deletions
|
@ -3,17 +3,27 @@ import unittest
|
||||||
from uptime_kuma_api import UptimeKumaApi
|
from uptime_kuma_api import UptimeKumaApi
|
||||||
|
|
||||||
|
|
||||||
|
token = None
|
||||||
|
|
||||||
|
|
||||||
class UptimeKumaTestCase(unittest.TestCase):
|
class UptimeKumaTestCase(unittest.TestCase):
|
||||||
api = None
|
api = None
|
||||||
|
url = "http://127.0.0.1:3001"
|
||||||
|
username = "testuser"
|
||||||
password = "zS7zhQSc"
|
password = "zS7zhQSc"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.api = UptimeKumaApi("http://127.0.0.1:3001")
|
cls.api = UptimeKumaApi(cls.url)
|
||||||
username = "testuser"
|
|
||||||
if cls.api.need_setup():
|
global token
|
||||||
cls.api.setup(username, cls.password)
|
if not token:
|
||||||
cls.api.login(username, cls.password)
|
if cls.api.need_setup():
|
||||||
|
cls.api.setup(cls.username, cls.password)
|
||||||
|
r = cls.api.login(cls.username, cls.password)
|
||||||
|
token = r["token"]
|
||||||
|
|
||||||
|
cls.api.login_by_token(token)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
|
Loading…
Reference in a new issue