-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
106 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
""" | ||
版本号 | ||
""" | ||
VERSION = '0.0.15' | ||
VERSION = '0.0.16' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@File : __init__.py.py | ||
@Date : 2022-11-05 | ||
@Author : Peng Shiyu | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@File : auth_api.py | ||
@Date : 2022-11-05 | ||
@Author : Peng Shiyu | ||
""" | ||
|
||
|
||
def test_login(client): | ||
response = client.post('/api/login', json={ | ||
'username': 'admin', | ||
'password': '123456' | ||
}) | ||
|
||
assert response.json['code'] == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@File : test_cert.py | ||
@Date : 2022-11-05 | ||
@Author : Peng Shiyu | ||
""" | ||
|
||
|
||
def test_get_cert_information_not_login(client): | ||
response = client.post('/api/getCertInformation') | ||
assert response.json['code'] == 401 | ||
|
||
|
||
def test_get_cert_information_not_params(client, token): | ||
response = client.post( | ||
path='/api/getCertInformation', | ||
headers={'x-token': token} | ||
) | ||
|
||
assert response.json['code'] == -1 | ||
|
||
|
||
def test_get_cert_information(client, token): | ||
response = client.post('/api/getCertInformation', json={ | ||
'domain': 'www.baidu.com' | ||
}, headers={'x-token': token}) | ||
|
||
assert response.json['code'] == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@File : test_demo.py | ||
@Date : 2022-11-05 | ||
@Author : Peng Shiyu | ||
""" | ||
|
||
|
||
def test_index(client): | ||
response = client.get('/') | ||
assert 'id="app"' in response.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@File : conftest.py | ||
@Date : 2022-11-05 | ||
@Author : Peng Shiyu | ||
""" | ||
import pytest | ||
from flask.testing import FlaskClient | ||
|
||
from domain_admin.main import app | ||
|
||
|
||
@pytest.fixture() | ||
def client() -> FlaskClient: | ||
app.config.update({ | ||
"TESTING": True, | ||
}) | ||
|
||
with app.app_context(): | ||
client = app.test_client() | ||
|
||
return client | ||
|
||
|
||
@pytest.fixture() | ||
def token(client) -> str: | ||
response = client.post('/api/login', json={ | ||
'username': 'admin', | ||
'password': '123456' | ||
}) | ||
|
||
return response.json['data']['token'] |