def test_remote_file_owner_group(): user("foo") remote_file("/tmp/nginx.tar.gz", source="http://nginx.org/download/nginx-1.0.11.tar.gz", checksum="a41a01d7cd46e13ea926d7c9ca283a95", group="foo", owner="foo") assert_equals(sudo('stat -c "%G" /tmp/nginx.tar.gz'), "foo") assert_equals(sudo('stat -c "%U" /tmp/nginx.tar.gz'), "foo") user("foo", state="deleted")
def test_document_user(): user("foo") document("bat", group="foo") assert_equals(sudo('stat -c "%G" bat'), "foo") user("foo", state="deleted")
def test_document_owner(): user("foo") document("foobar", owner="foo") assert_equals(sudo('stat -c "%U" foobar'), "foo") user("foo", state="deleted")
def test_user_invalid_state(): user("alice", state="foobar")
def test_user_creation(): user("alice") users = sudo("cat /etc/passwd | awk -F: '{ print $1 }'") assert_in("alice", [u for u in users.split("\r\n")])
def test_user_deletion(): user("alice", state="deleted") users = sudo("cat /etc/passwd | awk -F: '{ print $1 }'") assert_not_in("alice", [u for u in users.split("\r\n")])
def test_directory_user(): user("foo") directory("/var/web/foobar", group="foo") assert_equals(sudo('stat -c "%G" /var/web/foobar'), "foo") user("foo", state="deleted")