Exemple #1
0
def test_empty_spaces():
    '''
    Tests that spaces configuration is mandatory
    '''
    with pytest.raises(ValueError):
        lambda_function.Options({
            'ATLASSIAN_CLOUD_NAME': 'url',
            'USERNAME': '******',
            'PASSWORD': '******',
            'SPACES': ''
        })
Exemple #2
0
def test_empty_password():
    '''
    Tests that password is mandatory
    '''
    with pytest.raises(ValueError):
        lambda_function.Options({
            'ATLASSIAN_CLOUD_NAME': 'url',
            'USERNAME': '******',
            'PASSWORD': '',
            'SPACES': 'S1=12,XYZ=900'
        })
Exemple #3
0
def test_spaces_unknown_space():
    '''
    Tests unknown space key
    '''
    options = lambda_function.Options({
        'ATLASSIAN_CLOUD_NAME': 'hello',
        'USERNAME': '******',
        'PASSWORD': '******',
        'SPACES': 'IG=42,AB=50'
    })

    assert options.parent_page_id('XY-100') == 0
Exemple #4
0
def test_spaces():
    '''
    Tests multiple space configuration
    '''
    options = lambda_function.Options({
        'ATLASSIAN_CLOUD_NAME': 'hello',
        'USERNAME': '******',
        'PASSWORD': '******',
        'SPACES': 'IG=42,AB=50'
    })

    assert options.parent_page_id('IG-100') == 42
Exemple #5
0
def test_can_create():
    '''
    Tests creating options instance
    '''
    options = lambda_function.Options({
        'ATLASSIAN_CLOUD_NAME': 'hello',
        'USERNAME': '******',
        'PASSWORD': '******',
        'SPACES': 'S1=12,XYZ=900'
    })

    assert options.base_url == 'hello'
    assert options.username == 'username'
    assert options.password == 'password'
Exemple #6
0
def test_missing_key():
    '''
    Missing key should raise an error.
    '''
    with pytest.raises(KeyError):
        lambda_function.Options({})