Example #1
0
def test_get_username_cram_md5_challenge():
    smtp = SmtpProtocol()
    smtp.init()

    smtp.rescode = 334
    smtp.request.auth_type = "cram-md5"
    smtp.parse_request("ZnJlZCA5ZTk1YWVlMDljNDBhZjJiODRhMGMyYjNiYmFlNzg2ZQ==")
    assert smtp.request.username == "fred"
    assert smtp.request.password is None
Example #2
0
def test_get_username_password_auth_plain():
    smtp = SmtpProtocol()
    smtp.init()

    user_pass = "******"
    smtp.rescode = 334
    smtp.request.auth_type = "plain"
    smtp.parse_request(user_pass)

    assert smtp.request.username == "testuser"
    assert smtp.request.password == "Aw3s0mP4zzs!"
Example #3
0
def test_get_username_password_auth_login_arg():
    smtp = SmtpProtocol()
    smtp.init()

    smtp.parse_request("AUTH LOGIN Zm9vZEBiZWVyLnBseg==")
    smtp.rescode = 334
    smtp.message = "UGFzc3dvcmQ6"
    smtp.parse_request("U2hvb3BEYVdob29wIQ==")

    assert smtp.request.username == "*****@*****.**"
    assert smtp.request.password == "ShoopDaWhoop!"