Skip to content

Add unit tests for core functions (fixes #10) - #47

Open
Larslllllll wants to merge 1 commit into
netanelcyber:mainfrom
Larslllllll:add-unit-tests-for-core-functions
Open

Add unit tests for core functions (fixes #10)#47
Larslllllll wants to merge 1 commit into
netanelcyber:mainfrom
Larslllllll:add-unit-tests-for-core-functions

Conversation

@Larslllllll

Copy link
Copy Markdown

Summary

Adds a comprehensive unit test suite for the AdPenTest core module, covering SMTP enumeration, authentication, tool discovery, command building, and execution functions.

Tests Added

SMTP Functions

  • smtp_vrfy_enum — valid users, all invalid, connection error
  • smtp_rcpt_enum — valid recipients, all invalid, connection error
  • smtp_auth_test — success, failure, connection error, no-TLS mode
  • smtp_connect_test — return type and signature verification

AD Tool Functions

  • discover_tools — all available, none available, partial availability
  • build_ad_command — nmap command generation, tool-not-found error
  • execute_ad_tool — successful execution, timeout handling

Test Infrastructure

  • tests/conftest.py — shared pytest fixtures (mock_smtp, mock_socket)
  • tests/test_core.py — 17 test cases across 6 test classes
  • tests/__init__.py — package marker

Framework

  • pytest with unittest.mock for mocking SMTP/LDAP/DNS services
  • All 17 tests pass

Closes #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant