From 6fef6dec5d329843a5da35849fa2d8c1a65574a3 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 17 Nov 2025 16:04:10 -0500 Subject: [PATCH] qa/workunits/smb: add test_simple_smb.py very simple smb tests Signed-off-by: John Mulligan --- qa/workunits/smb/tests/test_simple_smb.py | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 qa/workunits/smb/tests/test_simple_smb.py diff --git a/qa/workunits/smb/tests/test_simple_smb.py b/qa/workunits/smb/tests/test_simple_smb.py new file mode 100644 index 00000000000..1e58b6ac1b0 --- /dev/null +++ b/qa/workunits/smb/tests/test_simple_smb.py @@ -0,0 +1,37 @@ +import pytest + +import smbutil + + +@pytest.mark.default +def test_arbitrary_listdir(smbconf, share_name): + with smbutil.connection(smbconf, share_name) as sharep: + contents = sharep.listdir() + assert isinstance(contents, list) + + +@pytest.mark.default +def test_create_dir(smbconf, share_name): + with smbutil.connection(smbconf, share_name) as sharep: + tdir = sharep / 'test_create_dir' + tdir.mkdir(exist_ok=True) + try: + contents = sharep.listdir() + assert 'test_create_dir' in contents + finally: + tdir.rmdir() + + +@pytest.mark.default +def test_create_file(smbconf, share_name): + with smbutil.connection(smbconf, share_name) as sharep: + fname = sharep / 'file1.dat' + fname.write_text('HELLO WORLD\n') + try: + contents = sharep.listdir() + assert 'file1.dat' in contents + + txt = fname.read_text() + assert txt == 'HELLO WORLD\n' + finally: + fname.unlink() -- 2.47.3