Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest
from pathlib import Path


@pytest.fixture(scope="session")
def mock_data_root_dir() -> Path:
test_root = Path(__file__).parent.resolve()
return test_root / "data"
14 changes: 14 additions & 0 deletions tests/data/config_case_insensitive.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Host test1
HostName test1.com
User test1user
Port 1111

Host test2
HostName test2.com
User test2user
port 2222

Host test3
HostName test3.com
User test3user
PORT 3333
9 changes: 9 additions & 0 deletions tests/data/config_complex.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Host complex
HostName complex.example.com
User complex_user
Port 2020
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
LocalForward 8080 localhost:80
ProxyCommand ssh proxy.example.com -W %h:%p
ServerAliveInterval 60
16 changes: 16 additions & 0 deletions tests/data/config_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# server-one
Host testHost1
# server-one Hostname
HostName test.hostname1.com
# server-one User
User testUser1
# server-one Port
Port 22
# server-two
Host testHost2
# server-two Hostname
Hostname test.hostname2.com
# server-two User
User testUser2
# server-two Port
Port 2222
7 changes: 7 additions & 0 deletions tests/data/config_defaults.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Host minimal-server
HostName minimal.example.com
# No user or port specified

Host partial-server
User partial_user
# No hostname or port specified
9 changes: 9 additions & 0 deletions tests/data/config_duplicate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Host duplicate
HostName first.example.com
User first_user
Port 1111

Host duplicate
HostName second.example.com
User second_user
Port 2222
3 changes: 3 additions & 0 deletions tests/data/config_empty_and_only_comments.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This is just a comment file
# No actual hosts defined
# Host fake_host (this is still a comment)
17 changes: 17 additions & 0 deletions tests/data/config_incomplete.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Host complete_host
HostName complete.example.com
User complete_user
Port 8080

Host hostname_only
HostName hostname.only.com

Host user_only
User user_only_user

Host minimal_host

# Empty host block
Host empty_host
# Just comments
# No actual config
11 changes: 11 additions & 0 deletions tests/data/config_inline_comments.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Host inline_test # This is an inline comment
HostName inline.example.com # Another comment
User inline_user # User comment
Port 5050 # Port comment

# Production server
Host server-one
HostName server-one.example.com
User username
# Port 1234 # Commented out port
Port 56
9 changes: 9 additions & 0 deletions tests/data/config_malformed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Host good_host
HostName good.example.com
User good_user

This is not a valid config line
Host another_host
HostName another.example.com
InvalidDirective this_should_be_ignored
User another_user
9 changes: 9 additions & 0 deletions tests/data/config_mixed_case.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Host MixedCase
hostname mixed.case.com
user mixeduser
port 3333

Host lowercase
HOSTNAME UPPER.CASE.COM
USER UPPERUSER
PORT 4444
9 changes: 9 additions & 0 deletions tests/data/config_special_chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Host special-chars_123
HostName special-chars.example.com
User user-with_underscores
Port 9999

Host numbers123
HostName 10.0.0.1
User user123
Port 22
9 changes: 9 additions & 0 deletions tests/data/config_whitespace.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Host whitespace_test
HostName whitespace.example.com
User whitespace_user
Port 8888

Host tab_test
HostName tab.example.com
User tab_user
Port 9999
12 changes: 12 additions & 0 deletions tests/data/config_wildcard_filtering.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Host *
Compression yes
User default_user

Host server-one
HostName server-one.example.com
User username
Port 22

Host *.example.com
User wildcard_user
Port 3030
14 changes: 14 additions & 0 deletions tests/data/config_with_indentations.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Host indented1
HostName deeply.indented.com
User indented_user
Port 5555

Host indented2
HostName normal.indent.com
User normal_user
Port 6666

Host mixed_indent
HostName no.indent.com
User some_indent
Port 7777
14 changes: 14 additions & 0 deletions tests/data/config_with_ports.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Host server1
HostName 192.168.1.100
User admin
Port 2222

Host server2
HostName example.com
User root
Port 443

# Commented host should be ignored
# Host commented_host
# HostName should.not.appear.com
# User ignored_user
Loading