Skip to content

Commit

Permalink
Added test_basic_io.py
Browse files Browse the repository at this point in the history
---A basic smb2 test to do
	session setup
	tree connect
	file create, write, read, close
  • Loading branch information
isi-adas committed Jul 15, 2024
1 parent 12db06a commit 8a20c76
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_basic_io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2024 Dell Inc. or its subsidiaries. All Rights Reserved.
from __future__ import absolute_import

import io
import string
import uuid

import pytest

import pike.ntstatus
import pike.smb2


@pytest.fixture
def filename():
return "test_io_{}.txt".format(uuid.uuid4())


def test_basic_read_write(pike_TreeConnect, filename):
with pike_TreeConnect() as tc:
with tc.chan.create(
tc.tree,
filename,
access=pike.smb2.GENERIC_READ | pike.smb2.GENERIC_WRITE | pike.smb2.DELETE,
options=pike.smb2.FILE_DELETE_ON_CLOSE,
).result() as fh:
buf = "test123"
tc.chan.write(fh, 0, buf)
assert tc.chan.read(fh, len(buf), 0).tobytes().decode() == buf

0 comments on commit 8a20c76

Please sign in to comment.