Exemple #1
0
def test_get_spamc_ssl_argument_nonexistent():
    path = '/etc/mail/spamassassin/spamc.conf'
    fileops = MockFileOperations()

    value = lib_spamc.get_spamc_ssl_argument(fileops.read)

    assert fileops.files_read == {path: 1}
    assert value is None
Exemple #2
0
def test_get_spamc_ssl_argument_inaccessible():
    path = '/etc/mail/spamassassin/spamc.conf'
    fileops = MockFileOperations(to_raise=make_IOError(errno.EACCES))

    value = lib_spamc.get_spamc_ssl_argument(fileops.read)

    assert fileops.files_read == {path: 1}
    assert value is None
Exemple #3
0
def test_get_spamc_ssl_argument():
    path = '/etc/mail/spamassassin/spamc.conf'
    fileops = MockFileOperations()
    fileops.files[path] = '--ssl sslv3'

    value = lib_spamc.get_spamc_ssl_argument(fileops.read)

    assert fileops.files_read == {path: 1}
    assert value == 'sslv3'
Exemple #4
0
def get_spamassassin_facts(read_func, listdir):
    """
    Reads the spamc configuration file, the spamassassin sysconfig file and checks
    whether the spamassassin service is overriden. Returns SpamassassinFacts.
    """
    spamc_ssl_argument = lib_spamc.get_spamc_ssl_argument(read_func)
    service_overriden = lib_spamd.spamassassin_service_overriden(listdir)
    spamd_ssl_version = lib_spamd.get_spamd_ssl_version(read_func)
    return SpamassassinFacts(spamc_ssl_argument=spamc_ssl_argument,
                             service_overriden=service_overriden,
                             spamd_ssl_version=spamd_ssl_version)