def test_remote_user_from_proto_fail():
     with pytest.raises(IncorrectTypeError) as err_info:
         RemoteUser.from_proto('')
     assert err_info.value.message == (
         "RemoteUser's parameter 'user' was"
         " type 'str' but should be of class 'dlpx.virtualization.api"
         ".common_pb2.RemoteUser'.")
 def test_remote_user_from_proto_success():
     remote_user_proto_buf = common_pb2.RemoteUser()
     remote_user = RemoteUser.from_proto(remote_user_proto_buf)
     assert isinstance(remote_user, RemoteUser)
 def test_remote_user_to_proto_non_default():
     remote_user = RemoteUser('name', 'reference')
     remote_user_proto = remote_user.to_proto()
     assert isinstance(remote_user_proto, common_pb2.RemoteUser)
 def test_init_remote_user_incorrect_reference():
     with pytest.raises(IncorrectTypeError) as err_info:
         RemoteUser('', 1)
     assert err_info.value.message == (
         "RemoteUser's parameter 'reference' was"
         " type 'int' but should be of type 'basestring'.")
 def test_init_remote_user_success():
     RemoteUser(name='name', reference='reference')
def remote_user():
    return RemoteUser("user", "user-reference")
Beispiel #7
0
def user():
    return RemoteUser(constants.username, constants.UserReference)