コード例 #1
0
ファイル: test_usercache.py プロジェクト: 01org/iris-panel
def test_get_by_email():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('David Robert Jones <*****@*****.**>')
    uc.update('David Bowie <*****@*****.**>')
    uc.update('*****@*****.**')

    assert uc.get('*****@*****.**')['email'] == '*****@*****.**'
コード例 #2
0
ファイル: scm.py プロジェクト: 01org/iris-panel
def build_user_cache(rawdata):
    """
    Go over all scm data to build a full UserCache
    """
    uc = UserCache()
    for typ, data in rawdata:
        for role in ROLES & set(data.keys()):
            for ustring in data[role]:
                uc.update(ustring)
    return uc
コード例 #3
0
def build_user_cache(rawdata):
    """
    Go over all scm data to build a full UserCache
    """
    uc = UserCache()
    for typ, data in rawdata:
        for role in ROLES & set(data.keys()):
            for ustring in data[role]:
                uc.update(ustring)
    return uc
コード例 #4
0
def test_user_without_email_will_be_ignored():
    uc = UserCache()
    uc.update('Brian May')
    uc.update('Roger Taylor')
    uc.update('Freddie Mercury <*****@*****.**>')

    assert uc.get('Brian May') is None
    assert uc.all() == [{
        'first_name': 'Freddie',
        'last_name': 'Mercury',
        'email': '*****@*****.**'
    }]
コード例 #5
0
def test_merge_3_forms():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('*****@*****.**')
    uc.update('David Bowie <*****@*****.**>')

    assert uc.all() == [{
        'first_name': 'David',
        'last_name': 'Bowie',
        'email': '*****@*****.**'
    }]
コード例 #6
0
ファイル: test_usercache.py プロジェクト: 01org/iris-panel
def test_user_without_email_will_be_ignored():
    uc = UserCache()
    uc.update('Brian May')
    uc.update('Roger Taylor')
    uc.update('Freddie Mercury <*****@*****.**>')

    assert uc.get('Brian May') is None
    assert uc.all() == [
        {'first_name': 'Freddie',
         'last_name': 'Mercury',
         'email': '*****@*****.**'}
        ]
コード例 #7
0
ファイル: test_usercache.py プロジェクト: 01org/iris-panel
def test_merge_3_forms():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('*****@*****.**')
    uc.update('David Bowie <*****@*****.**>')

    assert uc.all() == [
        {'first_name': 'David',
         'last_name': 'Bowie',
         'email': '*****@*****.**'}]
コード例 #8
0
def test_get_by_full():
    uc = UserCache()
    uc.update('*****@*****.**')
    uc.update('David Bowie <*****@*****.**>')

    assert uc.get('David Bowie <*****@*****.**>') == {
        'first_name': 'David',
        'last_name': 'Bowie',
        'email': '*****@*****.**'
    }
コード例 #9
0
def test_cannot_merge_name_and_email():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('*****@*****.**')

    assert uc.all() == [
        {
            'first_name': '',
            'last_name': '',
            'email': '*****@*****.**'
        },
    ]
コード例 #10
0
ファイル: test_usercache.py プロジェクト: 01org/iris-panel
def test_get_by_name():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('David Bowie <*****@*****.**>')

    assert uc.get('David Bowie') == {
        'first_name': 'David',
        'last_name': 'Bowie',
        'email': '*****@*****.**'}
コード例 #11
0
ファイル: test_usercache.py プロジェクト: 01org/iris-panel
def test_cannot_merge_diff_emails():
    uc = UserCache()
    uc.update('*****@*****.**')
    uc.update('*****@*****.**')

    assert uc.all() == [
        {'first_name': '', 'last_name': '', 'email': '*****@*****.**'},
        {'first_name': '', 'last_name': '', 'email': '*****@*****.**'},
        ]
コード例 #12
0
ファイル: test_usercache.py プロジェクト: 01org/iris-panel
def test_cannot_merge_name_and_email():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('*****@*****.**')

    assert uc.all() == [
        {'first_name': '',
         'last_name': '',
         'email': '*****@*****.**'},
        ]
コード例 #13
0
def test_cannot_merge_diff_emails():
    uc = UserCache()
    uc.update('*****@*****.**')
    uc.update('*****@*****.**')

    assert uc.all() == [
        {
            'first_name': '',
            'last_name': '',
            'email': '*****@*****.**'
        },
        {
            'first_name': '',
            'last_name': '',
            'email': '*****@*****.**'
        },
    ]
コード例 #14
0
ファイル: test_usercache.py プロジェクト: 01org/iris-panel
def test_different_names_with_the_same_email():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('David Robert Jones <*****@*****.**>')
    uc.update('David Bowie <*****@*****.**>')
    uc.update('David Robert Jones')
    uc.update('Bowie David <*****@*****.**>')

    users = uc.all()
    assert len(users) == 1 and users[0]['email'] == '*****@*****.**'
コード例 #15
0
ファイル: test_usercache.py プロジェクト: 01org/iris-panel
def test_cannot_merge_diff_names():
    uc = UserCache()
    uc.update('Eric Clapton')
    uc.update('Eric Johnson')

    assert uc.all() == []
コード例 #16
0
def test_get_by_email():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('David Robert Jones <*****@*****.**>')
    uc.update('David Bowie <*****@*****.**>')
    uc.update('*****@*****.**')

    assert uc.get('*****@*****.**')['email'] == '*****@*****.**'
コード例 #17
0
def test_different_names_with_the_same_email():
    uc = UserCache()
    uc.update('David Bowie')
    uc.update('David Robert Jones <*****@*****.**>')
    uc.update('David Bowie <*****@*****.**>')
    uc.update('David Robert Jones')
    uc.update('Bowie David <*****@*****.**>')

    users = uc.all()
    assert len(users) == 1 and users[0]['email'] == '*****@*****.**'
コード例 #18
0
def test_cannot_merge_diff_names():
    uc = UserCache()
    uc.update('Eric Clapton')
    uc.update('Eric Johnson')

    assert uc.all() == []