handle #55
Better handling if a bot is missing a DID, which could be a corrupt or outdated database.
This commit is contained in:
parent
da9d2bbea7
commit
e690436a37
3 changed files with 28 additions and 3 deletions
|
|
@ -84,7 +84,7 @@ async def test_login(aiohttp_client):
|
|||
assert "username" in jsonresp["data"]
|
||||
|
||||
remove_existing_db()
|
||||
bumper.db = "tests/tmp.db" # Set db location for testing
|
||||
bumper.db = "tests/tmp.db" # Set db location for testing
|
||||
|
||||
# Test global_e without user
|
||||
resp = await client.get("/v1/private/us/en/dev_1234/global_e/1/0/0/user/login")
|
||||
|
|
@ -118,6 +118,25 @@ async def test_login(aiohttp_client):
|
|||
assert "uid" in jsonresp["data"]
|
||||
assert "username" in jsonresp["data"]
|
||||
|
||||
# Add a bot to db that doesn't have a did
|
||||
newbot = {
|
||||
"class": "dev_1234",
|
||||
"company": "com_123",
|
||||
#"did": self.did,
|
||||
"name": "sn_1234",
|
||||
"resource": "res_1234",
|
||||
}
|
||||
bumper.bot_full_upsert(newbot)
|
||||
|
||||
resp = await client.get("/v1/private/us/en/dev_1234/ios/1/0/0/user/login")
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
jsonresp = json.loads(text)
|
||||
assert jsonresp["code"] == bumper.RETURN_API_SUCCESS
|
||||
assert "accessToken" in jsonresp["data"]
|
||||
assert "uid" in jsonresp["data"]
|
||||
assert "username" in jsonresp["data"]
|
||||
|
||||
|
||||
async def test_logout(aiohttp_client):
|
||||
remove_existing_db()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue