File: auth_test.py

package info (click to toggle)
elastalert 0.2.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,472 kB
  • sloc: python: 12,252; makefile: 108; sh: 2
file content (42 lines) | stat: -rw-r--r-- 803 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
from elastalert.auth import Auth, RefeshableAWSRequestsAuth


def test_auth_none():

    auth = Auth()(
        host='localhost:8080',
        username=None,
        password=None,
        aws_region=None,
        profile_name=None
    )

    assert not auth


def test_auth_username_password():

    auth = Auth()(
        host='localhost:8080',
        username='user',
        password='password',
        aws_region=None,
        profile_name=None
    )

    assert auth == 'user:password'


def test_auth_aws_region():

    auth = Auth()(
        host='localhost:8080',
        username=None,
        password=None,
        aws_region='us-east-1',
        profile_name=None
    )

    assert type(auth) == RefeshableAWSRequestsAuth
    assert auth.aws_region == 'us-east-1'