apache-ignite
51 строка · 2.1 Кб
1# Licensed to the Apache Software Foundation (ASF) under one or more
2# contributor license agreements. See the NOTICE file distributed with
3# this work for additional information regarding copyright ownership.
4# The ASF licenses this file to You under the Apache License, Version 2.0
5# (the "License"); you may not use this file except in compliance with
6# the License. You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""
17Check that get_credentials correctly parse Credentials from globals
18"""
19
20import pytest21from ignitetest.services.utils.auth import get_credentials, DEFAULT_AUTH_USERNAME, DEFAULT_AUTH_PASSWORD, \22USERNAME_KEY, PASSWORD_KEY, AUTHENTICATION_KEY, ENABLED_KEY23
24TEST_USERNAME = "admin"25TEST_PASSWORD = "qwe123"26
27
28class CheckCaseJks:29"""30Check that get_credentials correctly parse Credentials from globals
31Posible structure is:
32{"authentication": {
33"enabled": true,
34"username": "admin",
35"password": "qwe123"}}
36"""
37
38@staticmethod39@pytest.mark.parametrize('test_globals, expected_username, expected_password',40[({AUTHENTICATION_KEY: {41ENABLED_KEY: True,42USERNAME_KEY: TEST_USERNAME,43PASSWORD_KEY: TEST_PASSWORD}}, TEST_USERNAME,44TEST_PASSWORD),45({AUTHENTICATION_KEY: {46ENABLED_KEY: True}}, DEFAULT_AUTH_USERNAME, DEFAULT_AUTH_PASSWORD)])47def check_parse(test_globals, expected_username, expected_password):48"""49Check function for pytest
50"""
51assert (expected_username, expected_password) == get_credentials(test_globals)52