[Testing] Add unit tests for core protocol libraries (HTTP, SSH, FTP, SMTP, Telnet, POP3)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 1.2k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 16
Description
Summary
The protocol handler libraries under nettacker/core/lib/ are almost entirely untested.
Out of 13 protocol files, only 3 have test coverage (SMB, SSL, Socket).
The remaining 10 — including HTTP, SSH, FTP, FTPS, SMTP, SMTPS, POP3, POP3S, Telnet, and Base —
have zero unit tests.
Affected Files
nettacker/core/lib/base.py— base connection class (parent of all protocols)nettacker/core/lib/http.py— used by all scan/vuln modulesnettacker/core/lib/ssh.pynettacker/core/lib/ftp.py/ftps.pynettacker/core/lib/smtp.py/smtps.pynettacker/core/lib/pop3.py/pop3s.pynettacker/core/lib/telnet.py
What Needs to Be Done
- Write unit tests for
base.pycovering connection lifecycle, timeout handling, and error states - Write unit tests for
http.pycovering request building, response parsing, and condition matching (mockrequests) - Write unit tests for
ssh.pycovering auth attempts and error handling (mockparamiko) - Write unit tests for
ftp.py,ftps.pycovering login flows and error handling (mockftplib) - Write unit tests for
smtp.py,smtps.pycovering connection and auth flows - Write unit tests for
pop3.py,pop3s.py - Write unit tests for
telnet.py - Place tests in
tests/core/lib/test_<protocol>.pymatching the existing pattern
Acceptance Criteria
- All network calls must be mocked (no real connections)
- Each protocol file achieves ≥ 80% line coverage
- Tests run successfully with
pytest tests/core/lib/
Context
This is part of the GSoC 2026 goal to raise overall test coverage to 85%.
The existing tests/core/lib/test_socket.py and test_smb.py can serve as reference implementations.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/core/lib/test_socket.py and test_smb.py, then inspect the protocol files under nettacker/core/lib/. Add matching tests under tests/core/lib/test_.py with all network calls mocked, and run pytest tests/core/lib/; done means the listed protocols reach at least 80% line coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100