def test_scan_localhost_error_not_wordpress(self): # test info, warnings and alerts scanner = WPWatcherScanner( WPWatcherConfig(string=DEFAULT_CONFIG).build_config()[0]) report = scanner.scan_site( WPWatcher.format_site({'url': 'http://localhost:8080'})) self.assertEqual(report['status'], 'ERROR') self.assertRegex(report['error'], 'does not seem to be running WordPress')
from wpwatcher.core import WPWatcher from wpwatcher.config import WPWatcherConfig from wpwatcher.utils import get_valid_filename from wpwatcher.parser import parse_results from wpwatcher.notification import WPWatcherNotification from wpwatcher.scan import WPWatcherScanner import random import linecache # Constants NUMBER_OF_CONFIG_VALUES = 31 # Read URLS file # URLS="./wpwatcher-test-sites.txt.conf" WP_SITES = [ WPWatcher.format_site(s) for s in [{ "url": "exemple.com" }, { "url": "exemple2.com" }] ] # with open(URLS, 'r') as f: [ WP_SITES.append({'url':url.strip()}) for url in f.readlines() ] DEFAULT_CONFIG = """ [wpwatcher] wp_sites=%s smtp_server=localhost:1025 [email protected] email_to=["*****@*****.**"] """ % json.dumps(WP_SITES)