Пример #1
0
def test_create_user_enterpriseid():
    user = UserAction(id_type=IdentityTypes.enterpriseID, email="*****@*****.**")
    user.create(first_name="Daniel", last_name="Brotsky")
    assert user.wire_dict() == {"do": [{"createEnterpriseID": {"email": "*****@*****.**",
                                                               "firstname": "Daniel", "lastname": "Brotsky",
                                                               "option": "ignoreIfAlreadyExists"}}],
                                "user": "******"}
Пример #2
0
def test_split_add_user():
    """
    Make sure split doesn't do anything when we have a non-add/remove group action
    :return:
    """
    user = UserAction(id_type=IdentityTypes.enterpriseID,
                      email="*****@*****.**")
    user.create(first_name="Example",
                last_name="User",
                country="US",
                email="*****@*****.**")
    user.update(first_name="EXAMPLE")
    assert user.maybe_split_groups(10) is False
    assert len(user.commands) == 2
    assert user.wire_dict() == {
        'do': [{
            'createEnterpriseID': {
                'country': 'US',
                'email': '*****@*****.**',
                'firstname': 'Example',
                'lastname': 'User',
                'option': 'ignoreIfAlreadyExists'
            }
        }, {
            'update': {
                'firstname': 'EXAMPLE'
            }
        }],
        'user':
        '******'
    }
Пример #3
0
def test_create_user_federatedid_email_format_username():
    """
    Create federated ID with username in email format (with email address)
    :return:
    """
    user = UserAction(id_type=IdentityTypes.federatedID,
                      username="******",
                      domain="k.on-the-side.net",
                      email="*****@*****.**")
    user.create(first_name="Daniel", last_name="Brotsky", country="US")
    assert user.wire_dict() == {
        "do": [{
            "createFederatedID": {
                "email": "*****@*****.**",
                "firstname": "Daniel",
                "lastname": "Brotsky",
                "country": "US",
                "option": "ignoreIfAlreadyExists"
            }
        }],
        "user":
        "******",
        "domain":
        "k.on-the-side.net"
    }
Пример #4
0
def test_create_user_adobeid():
    user = UserAction(email="*****@*****.**")
    user.create()
    assert user.wire_dict() == {"do": [{"addAdobeID": {"email": "*****@*****.**",
                                                       "option": "ignoreIfAlreadyExists"}}],
                                "user": "******",
                                "useAdobeID": True}
Пример #5
0
def test_create_user_federatedid_username_unicode():
    """
    Test federated ID with a username and unicode attributes (non-email format)
    """
    user = UserAction(id_type=IdentityTypes.federatedID,
                      username=u"user",
                      domain="example.com")
    user.create(first_name=u"Exampłę",
                last_name="User",
                country="PL",
                email=u"*****@*****.**")
    assert user.wire_dict() == {
        "do": [{
            "createFederatedID": {
                "email": u"*****@*****.**",
                "firstname": u"Exampłę",
                "lastname": "User",
                "country": "PL",
                "option": "ignoreIfAlreadyExists"
            }
        }],
        "user":
        u"user",
        "domain":
        "example.com"
    }
Пример #6
0
def test_create_user_federatedid_username_mismatch():
    """
    Mismatched email in UserAction constructor vs create()
    """
    user = UserAction(id_type=IdentityTypes.federatedID, username="******", domain="example.com",
                      email="*****@*****.**")
    with pytest.raises(ValueError):
        user.create(first_name="Example", last_name="User", country="US", email="*****@*****.**")
def test_create_user_federatedid_username_mismatch():
    user = UserAction(id_type=IdentityTypes.federatedID,
                      username="******",
                      domain="k.on-the-side.net",
                      email="*****@*****.**")
    with pytest.raises(ValueError):
        user.create(first_name="Daniel",
                    last_name="Brotsky",
                    country="US",
                    email="*****@*****.**")
Пример #8
0
def test_create_user_federatedid_unicode():
    """
    Test federated ID action with email address and no username and unicode in at least one attribute
    """
    user = UserAction(id_type=IdentityTypes.federatedID, email=u"*****@*****.**")
    user.create(first_name=u"Exampłę", last_name="User", country="PL")
    assert user.wire_dict() == {"do": [{"createFederatedID": {"email": u"*****@*****.**",
                                                              "firstname": u"Exampłę", "lastname": "User",
                                                              "country": "PL",
                                                              "option": "ignoreIfAlreadyExists"}}],
                                "user": u"*****@*****.**"}
Пример #9
0
def test_create_user_federatedid():
    """
    Test federated ID action with email address and no username
    """
    user = UserAction(id_type=IdentityTypes.federatedID, email="*****@*****.**")
    user.create(first_name="Example", last_name="User", country="US")
    assert user.wire_dict() == {"do": [{"createFederatedID": {"email": "*****@*****.**",
                                                              "firstname": "Example", "lastname": "User",
                                                              "country": "US",
                                                              "option": "ignoreIfAlreadyExists"}}],
                                "user": "******"}
def test_create_user_federated_id_unicode():
    user = UserAction(id_type=IdentityTypes.federatedID,
                      email=u"*****@*****.**")
    user.create(first_name="Lech", last_name=u"Wałęsa", country="PL")
    assert user.wire_dict() == {
        "do": [{
            "createFederatedID": {
                "email": u"*****@*****.**",
                "firstname": "Lech",
                "lastname": u"Wałęsa",
                "country": "PL",
                "option": "ignoreIfAlreadyExists"
            }
        }],
        "user":
        u"*****@*****.**"
    }
def test_create_user_federatedid():
    user = UserAction(id_type=IdentityTypes.federatedID,
                      email="*****@*****.**")
    user.create(first_name="Daniel", last_name="Brotsky", country="US")
    assert user.wire_dict() == {
        "do": [{
            "createFederatedID": {
                "email": "*****@*****.**",
                "firstname": "Daniel",
                "lastname": "Brotsky",
                "country": "US",
                "option": "ignoreIfAlreadyExists"
            }
        }],
        "user":
        "******"
    }