paijo77 commited on
Commit
cbd8d01
·
verified ·
1 Parent(s): 2103afb

update tests/unit/test_candidate_model.py

Browse files
Files changed (1) hide show
  1. tests/unit/test_candidate_model.py +33 -0
tests/unit/test_candidate_model.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from app.db_models import CandidateSource
2
+
3
+
4
+ def test_candidate_source_defaults():
5
+ # SQLAlchemy models don't apply 'default' on __init__ without a session
6
+ # So we check the Column configuration instead
7
+ assert CandidateSource.status.default.arg == "pending"
8
+ assert CandidateSource.confidence_score.default.arg == 0
9
+ assert CandidateSource.proxies_found_count.default.arg == 0
10
+ assert CandidateSource.fail_count.default.arg == 0
11
+
12
+ candidate = CandidateSource(
13
+ url="http://example.com/proxies.txt", discovery_method="github"
14
+ )
15
+ # Explicitly check what we set
16
+ assert candidate.url == "http://example.com/proxies.txt"
17
+ assert candidate.discovery_method == "github"
18
+
19
+
20
+ def test_candidate_source_fields():
21
+ candidate = CandidateSource(
22
+ url="http://test.com",
23
+ domain="test.com",
24
+ discovery_method="ai",
25
+ status="approved",
26
+ confidence_score=90,
27
+ meta_data={"summary": "found by ai"},
28
+ )
29
+
30
+ assert candidate.domain == "test.com"
31
+ assert candidate.status == "approved"
32
+ assert candidate.confidence_score == 90
33
+ assert candidate.meta_data == {"summary": "found by ai"}