File size: 636 Bytes
d488241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pytest
from app.services.ai_processor import AIPipeline
from app.services.scraper import FacebookScraper

def test_ai_processor():
    ai = AIPipeline()
    result = ai.process_ad("This is a positive ad!")
    assert "sentiment" in result

def test_scraper():
    scraper = FacebookScraper()
    ads = scraper.scrape_ads("test query", num_scrolls=1)
    assert isinstance(ads, list)

def test_blockchain():
    from app.services.blockchain import AdBlockchain
    blockchain = AdBlockchain()
    block = blockchain.create_block(proof=123, previous_hash="abc")
    assert block["index"] == 2
    assert blockchain.is_chain_valid()