File diff 6bb8ed6d6443 → d752715bb533
roles/common/molecule/default/tests/test_parameters_optional.py
Show inline comments
 
@@ -32,8 +32,8 @@ def test_bash_prompt_content(host):
 

	
 
    config = host.file('/etc/profile.d/bash_prompt.sh')
 

	
 
    assert "export PS1='\\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[0;36m\\]\\u@\\h[test]:\\w\\$ \\[\\033[0m\\]'" in config.content
 
    assert "export PS1='\\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\u@\\h[test]:\\w\\$ '" in config.content
 
    assert "export PS1='\\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[0;36m\\]\\u@\\h[test]:\\w\\$ \\[\\033[0m\\]'" in config.content_string
 
    assert "export PS1='\\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\u@\\h[test]:\\w\\$ '" in config.content_string
 

	
 

	
 
def test_common_installed_packages_common(host):
 
@@ -78,7 +78,7 @@ def test_emacs_electric_indent_mode(host):
 
    assert emacs_config.user == 'root'
 
    assert emacs_config.group == 'root'
 
    assert emacs_config.mode == 0o644
 
    assert "(electric-indent-mode -1)" in emacs_config.content
 
    assert "(electric-indent-mode -1)" in emacs_config.content_string
 

	
 

	
 
def test_os_groups(host):
 
@@ -129,8 +129,8 @@ def test_os_users(host):
 
        assert user2.password == '$6$wdXOQiMe09ugh0$VRIph2XA2QQyEYlAlH7zT4TPACDUalf/4FKpqG9JRHfKxANTcTug2ANCt450htcs0LikJfHLWofLP54jraFU61'
 

	
 
        user2_authorized_keys = host.file(os.path.join(user2.home, '.ssh', 'authorized_keys'))
 
        assert open('tests/data/ssh/clientkey1.pub', 'r').read().strip() in user2_authorized_keys.content
 
        assert open('tests/data/ssh/clientkey2.pub', 'r').read().strip() in user2_authorized_keys.content
 
        assert open('tests/data/ssh/clientkey1.pub', 'r').read().strip() in user2_authorized_keys.content_string
 
        assert open('tests/data/ssh/clientkey2.pub', 'r').read().strip() in user2_authorized_keys.content_string
 

	
 
        user3 = host.user('user3')
 
        assert user3.uid == 2002
 
@@ -140,7 +140,7 @@ def test_os_users(host):
 
        assert user3.password == '$6$nmx.21uLqT$9LrUqNUgUwIM.l0KFKgr2.kDEwe2lo7IbBIhnG70AGW7GTFdWBUFnGAxH15YxikTXhDJD/uxd.NNgojEOjRvx1'
 

	
 
        user3_authorized_keys = host.file(os.path.join(user3.home, '.ssh', 'authorized_keys'))
 
        assert open('tests/data/ssh/clientkey3.pub', 'r').read().strip() in user3_authorized_keys.content
 
        assert open('tests/data/ssh/clientkey3.pub', 'r').read().strip() in user3_authorized_keys.content_string
 

	
 

	
 
def test_authorized_keys_login(host):
 
@@ -217,7 +217,7 @@ def test_ferm_base_rules(host):
 
    with host.sudo():
 
        ferm_base = host.file('/etc/ferm/conf.d/00-base.conf')
 

	
 
        assert "mod hashlimit hashlimit 5/second hashlimit-burst 5" in ferm_base.content
 
        assert "mod hashlimit hashlimit 5/second hashlimit-burst 5" in ferm_base.content_string
 

	
 
        iptables = host.command('iptables-save')
 

	
 
@@ -262,15 +262,15 @@ def test_backup_configuration(host):
 

	
 
        common = host.file('/etc/duply/main/patterns/common')
 
        assert common.is_file
 
        assert "/var/log" in common.content.split("\n")
 
        assert "/etc/shadow" in common.content.split("\n")
 
        assert "/var/mail" in common.content.split("\n")
 
        assert "/var/spool/cron" in common.content.split("\n")
 
        assert "/var/log" in common.content_string.split("\n")
 
        assert "/etc/shadow" in common.content_string.split("\n")
 
        assert "/var/mail" in common.content_string.split("\n")
 
        assert "/var/spool/cron" in common.content_string.split("\n")
 

	
 
        common_extra = host.file('/etc/duply/main/patterns/common_extra')
 
        assert common_extra.is_file
 
        assert "/home/user1" in common_extra.content.split("\n")
 
        assert "/home/user2" in common_extra.content.split("\n")
 
        assert "/home/user1" in common_extra.content_string.split("\n")
 
        assert "/home/user2" in common_extra.content_string.split("\n")
 

	
 

	
 
def test_ntp_software_installed(host):
 
@@ -290,7 +290,7 @@ def test_ntp_server_configuration(host):
 
    with host.sudo():
 

	
 
        # Read the configuration file.
 
        configuration = host.file("/etc/ntp.conf").content.split("\n")
 
        configuration = host.file("/etc/ntp.conf").content_string.split("\n")
 

	
 
        # Extract only the relevant sections of files (exculde empty
 
        # lines and comments).