Skip to content

Commit

Permalink
Update CI code (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
jborean93 authored Jun 25, 2023
1 parent ee7d9f7 commit f7eca41
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black

Expand Down
2 changes: 1 addition & 1 deletion build_helpers/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lib::setup::smb_server() {
--publish ${SMB_PORT}:445 \
--volume $( pwd )/build_helpers:/app:z \
--workdir /app \
fedora:36 \
debian:12 \
/bin/bash \
/app/samba-setup.sh \
${SMB_SHARE} \
Expand Down
3 changes: 2 additions & 1 deletion build_helpers/samba-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ SMB_SHARE="$1"
SMB_USER="$2"
SMB_PASSWORD="$3"

dnf install -y \
apt update
apt install -y \
samba

cat > /etc/samba/smb.conf << EOL
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "smbprotocol"
version = "1.10.1"
version = "1.10.2"
description = "Interact with a server using the SMB 2/3 Protocol"
readme = "README.md"
requires-python = ">=3.7"
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
black
black == 23.3.0
build
cryptography >= 2.0
isort
isort == 5.11.5
pre-commit
pyspnego
pytest
Expand Down
44 changes: 5 additions & 39 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,12 +869,6 @@ def test_dialect_2_0_2(self, smb_real):
assert connection.sequence_window["low"] == 1
assert connection.sequence_window["high"] == 2
assert connection.client_security_mode == SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED

# server settings override the require signing
assert (
connection.server_security_mode & SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
== SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
)
assert not connection.supports_encryption
assert connection.require_signing
finally:
Expand All @@ -892,12 +886,6 @@ def test_dialect_2_1_0(self, smb_real):
assert connection.sequence_window["low"] == 1
assert connection.sequence_window["high"] == 2
assert connection.client_security_mode == SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED

# server settings override the require signing
assert (
connection.server_security_mode & SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
== SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
)
assert not connection.supports_encryption
assert connection.require_signing
finally:
Expand All @@ -915,12 +903,6 @@ def test_dialect_3_0_0(self, smb_real):
assert connection.sequence_window["low"] == 1
assert connection.sequence_window["high"] == 2
assert connection.client_security_mode == SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED

# server settings override the require signing
assert (
connection.server_security_mode & SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
== SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
)
assert connection.supports_encryption
assert connection.require_signing
finally:
Expand All @@ -938,12 +920,6 @@ def test_dialect_3_0_2(self, smb_real):
assert connection.sequence_window["low"] == 1
assert connection.sequence_window["high"] == 2
assert connection.client_security_mode == SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED

# server settings override the require signing
assert (
connection.server_security_mode & SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
== SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
)
assert connection.supports_encryption
assert connection.require_signing
finally:
Expand All @@ -961,16 +937,12 @@ def test_dialect_3_1_1_not_require_signing(self, smb_real):
assert connection.sequence_window["low"] == 1
assert connection.sequence_window["high"] == 2
assert connection.client_security_mode == SecurityMode.SMB2_NEGOTIATE_SIGNING_ENABLED

# server settings override the require signing
assert (
connection.server_security_mode & SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
== SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED
)
assert connection.supports_encryption
# for tests we set that server requires signing so that overrides
# the client setting
assert connection.require_signing

if connection.server_security_mode & SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED:
assert connection.require_signing
else:
assert not connection.require_signing
finally:
connection.disconnect()

Expand All @@ -992,12 +964,6 @@ def test_dialect_implicit_require_signing(self, smb_real):
assert connection.sequence_window["low"] == 1
assert connection.sequence_window["high"] == 2
assert connection.client_security_mode == SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED

# server settings override the require signing
assert (
connection.server_security_mode
== SecurityMode.SMB2_NEGOTIATE_SIGNING_REQUIRED | SecurityMode.SMB2_NEGOTIATE_SIGNING_ENABLED
)
assert connection.supports_encryption
assert connection.require_signing
finally:
Expand Down

0 comments on commit f7eca41

Please sign in to comment.