Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _data/mentors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
- name: Madhura Chaganty
disabled: false
matched: false
sort: 200
sort: 100
hours: 2
type: ad-hoc
index: 7
Expand All @@ -215,7 +215,7 @@
image: assets/images/mentors/madhura_chaganty.jpeg
location: United Kingdom
languages: English
availability: [10]
availability: []
skills:
experience: 16+ Years
years: 16
Expand Down
22 changes: 11 additions & 11 deletions tools/tests/download_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,30 @@ def test_filename_sanitization(self, tmp_path, monkeypatch):


class TestRunAutomation:
def test_run_automation_success(self, tmp_path, monkeypatch, capsys):
monkeypatch.setattr(sys, "argv", ["download_image.py", "https://example.com/test.jpg", "Charlie"])
def test_run_automation_success(self, tmp_path, monkeypatch, caplog):
caplog.set_level("INFO")
monkeypatch.setattr(sys, "argv", ["download_image.py", "tools/samples/mentors.xlsx"])

fake_path = str(tmp_path / "charlie.jpeg")
fake_path = str(tmp_path / "success-download.jpeg")
monkeypatch.setattr(download_image, "download_image", mock.Mock(return_value=fake_path))

download_image.run_automation()

captured = capsys.readouterr()
assert "Image saved to" in captured.out
download_image.download_image.assert_called_once()
assert "Successfully downloaded 2 images." in caplog.text
assert "Image download process completed." in caplog.text

def test_run_automation_failure(self, monkeypatch, capsys):
monkeypatch.setattr(sys, "argv", ["download_image.py", "https://example.com/fail.jpg", "David"])
def test_run_automation_failure(self, monkeypatch, caplog):
caplog.set_level("INFO")
monkeypatch.setattr(sys, "argv", ["download_image.py", "tools/samples/mentors.xlsx"])
monkeypatch.setattr(download_image, "download_image", mock.Mock(return_value=None))

download_image.run_automation()
captured = capsys.readouterr()
assert "Failed to download the image." in captured.out
assert "Successfully downloaded 0 images." in caplog.text

def test_run_automation_no_args(self, monkeypatch, caplog):
monkeypatch.setattr(sys, "argv", ["download_image.py"])
caplog.set_level("INFO")

download_image.run_automation()

assert "Add parameters for download" in caplog.text
assert "Script needs 1 parameter (xlsx_file_path) to run" in caplog.text