apache-ignite

Форк
0
/
check_get_credentials_from_globals.py 
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
"""
17
Check that get_credentials correctly parse Credentials from globals
18
"""
19

20
import pytest
21
from ignitetest.services.utils.auth import get_credentials, DEFAULT_AUTH_USERNAME, DEFAULT_AUTH_PASSWORD, \
22
    USERNAME_KEY, PASSWORD_KEY, AUTHENTICATION_KEY, ENABLED_KEY
23

24
TEST_USERNAME = "admin"
25
TEST_PASSWORD = "qwe123"
26

27

28
class CheckCaseJks:
29
    """
30
    Check that get_credentials correctly parse Credentials from globals
31
    Posible structure is:
32
    {"authentication": {
33
        "enabled": true,
34
        "username": "admin",
35
        "password": "qwe123"}}
36
    """
37

38
    @staticmethod
39
    @pytest.mark.parametrize('test_globals, expected_username, expected_password',
40
                             [({AUTHENTICATION_KEY: {
41
                                 ENABLED_KEY: True,
42
                                 USERNAME_KEY: TEST_USERNAME,
43
                                 PASSWORD_KEY: TEST_PASSWORD}}, TEST_USERNAME,
44
                               TEST_PASSWORD),
45
                                 ({AUTHENTICATION_KEY: {
46
                                     ENABLED_KEY: True}}, DEFAULT_AUTH_USERNAME, DEFAULT_AUTH_PASSWORD)])
47
    def check_parse(test_globals, expected_username, expected_password):
48
        """
49
        Check function for pytest
50
        """
51
        assert (expected_username, expected_password) == get_credentials(test_globals)
52

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.