Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
laramies
GitHub Repository: laramies/theHarvester
Path: blob/master/tests/lib/test_output.py
888 views
1
from __future__ import annotations
2
3
4
from theHarvester.lib.output import print_linkedin_sections, sorted_unique
5
6
7
def test_sorted_unique_sorts_and_deduplicates() -> None:
8
assert sorted_unique(["b", "a", "b"]) == ["a", "b"]
9
10
11
def test_print_linkedin_sections_prints_links_when_present(capsys) -> None:
12
# Regression coverage: the CLI previously never printed LinkedIn links when the list was non-empty.
13
print_linkedin_sections(
14
engines=["linkedin"],
15
people=[],
16
links=["https://b.example", "https://a.example", "https://a.example"],
17
)
18
19
out = capsys.readouterr().out
20
assert "No LinkedIn users found" in out
21
assert "LinkedIn Links found: 3" in out
22
assert "https://a.example" in out
23
assert "https://b.example" in out
24
25
26
def test_print_linkedin_sections_prints_people_and_links(capsys) -> None:
27
print_linkedin_sections(
28
engines=["rocketreach"],
29
people=["bob", "alice", "bob"],
30
links=["https://z.example", "https://z.example"],
31
)
32
33
out = capsys.readouterr().out
34
assert "LinkedIn Users found: 3" in out
35
assert "alice" in out
36
assert "bob" in out
37
assert "LinkedIn Links found: 2" in out
38
assert "https://z.example" in out
39
40