test_update.py 1.0 KB

123456789101112131415161718192021222324252627
  1. import sqlite3
  2. from .fixtures import *
  3. def test_update_status_invalid(tmp_path, process, disable_extractors_dict):
  4. subprocess.run(['archivebox', 'add', 'http://127.0.0.1:8080/static/example.com.html'], capture_output=True, env=disable_extractors_dict)
  5. assert list((tmp_path / "archive").iterdir()) != []
  6. a_process = subprocess.run(['archivebox', 'remove', 'http://127.0.0.1:8080/static/example.com.html', '--yes'], capture_output=True)
  7. conn = sqlite3.connect(str(tmp_path / "index.sqlite3"))
  8. c = conn.cursor()
  9. link = c.execute("SELECT * FROM core_snapshot").fetchone()
  10. conn.commit()
  11. conn.close()
  12. assert link is None
  13. update_process = subprocess.run(['archivebox', 'update', '--status=invalid'], capture_output=True, env=disable_extractors_dict)
  14. conn = sqlite3.connect(str(tmp_path / "index.sqlite3"))
  15. c = conn.cursor()
  16. url = c.execute("SELECT url FROM core_snapshot").fetchone()[0]
  17. conn.commit()
  18. conn.close()
  19. assert url == 'http://127.0.0.1:8080/static/example.com.html'