Skip to content

Commit 2c49ecb

Browse files
committed
Enhance network tests in test_network.py
- Added newlines for consistent formatting and improved readability. - Updated the test for network client connection error to raise a NetworkError on connection failure. - Ensured the test for network send includes a newline at the end of the file for consistency.
1 parent a9a0395 commit 2c49ecb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/test_network.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
import pytest
2+
23
from ransomware.network.client import NetworkClient
34
from ransomware.config import AppConfig
45
from ransomware.exceptions import NetworkError
56

7+
68
class DummyConfig(AppConfig):
79
c2_server_url: str = "http://localhost:9999"
810
encryption_key_path: str = "/tmp/key"
911

12+
1013
def test_network_client_connection_error(monkeypatch):
1114
config = DummyConfig()
1215
client = NetworkClient(config)
16+
1317
def mock_post(*args, **kwargs):
1418
raise Exception("Connection failed")
19+
1520
monkeypatch.setattr("requests.post", mock_post)
21+
1622
with pytest.raises(NetworkError):
1723
client.send_data("test", {"foo": "bar"})
1824

25+
1926
def test_network_connection():
2027
# Dummy test for network connection
2128
assert True
2229

30+
2331
def test_network_send():
2432
# Dummy test for network send
2533
def dummy():
2634
pass
27-
assert True
35+
36+
assert True

0 commit comments

Comments
 (0)