refactor: Use __version__ instead of VERSION in constants

Remove the VERSION from constants. Just use __version__ as
version in profile.

Change-Id: I6128077182e223d708c17753524a1f42dc6fad27
This commit is contained in:
zhu.boxiang 2021-07-01 15:26:43 +08:00
parent c1bb509391
commit 8eb2825b9b
4 changed files with 6 additions and 6 deletions

View File

@ -25,6 +25,7 @@ from fastapi import HTTPException, status
from jose import jwt
from skyline_log import LOG
from skyline_apiserver import __version__
from skyline_apiserver import schemas
from skyline_apiserver.client import utils
from skyline_apiserver.client.utils import get_system_session
@ -136,7 +137,7 @@ async def generate_profile(
base_domains=CONF.openstack.base_domains,
exp=exp or int(time.time()) + CONF.default.access_token_expire,
uuid=uuid_value or uuid.uuid4().hex,
version=constants.VERSION,
version=__version__,
license=license,
currency=currency,
)

View File

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
VERSION = "8.1.0"
ALGORITHM = "HS256"
KEYSTONE_API_VERSION = "3.13"

View File

@ -19,6 +19,7 @@ import pytest
from httpx import AsyncClient
from utils import utils
from skyline_apiserver import __version__
from skyline_apiserver import main
from skyline_apiserver.config import CONF
from skyline_apiserver.db import api as db_api, setup as db_setup
@ -62,7 +63,7 @@ async def test_get_profile_ok(client: AsyncClient, login_jwt: str) -> None:
assert "base_domains" in result
assert "license" in result
assert "currency" in result
assert result["version"] == constants.VERSION
assert result["version"] == __version__
assert len(CONF.openstack.base_domains) == len(result["base_domains"])

View File

@ -17,8 +17,8 @@ import uuid
from httpx import AsyncClient
from skyline_apiserver import __version__
from skyline_apiserver import config, main, schemas
from skyline_apiserver.types import constants
def get_session_profile() -> schemas.Profile:
@ -63,7 +63,7 @@ def get_session_profile() -> schemas.Profile:
"4c017648d2e34d1a8e732b98e3232af9": {"name": "alt_demo", "domain_id": "default"},
"e88226c062094881b7a1f01517b945b4": {"name": "admin", "domain_id": "default"},
},
version=constants.VERSION,
version=__version__,
license={
"name": "test_license_name",
"summary": "test_license_summary",