Skip to content

Commit

Permalink
renamed test cases as per the new naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-yaash committed Oct 13, 2024
1 parent f2d3d96 commit 1e18921
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/test_graph.py → tests/test_clip.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
from package.graph import display
from package.clip import display
from datetime import datetime
import subprocess
from package.graph import copy_to_clipboard
from package.clip import copy_to_clipboard
import os
import sys
import shutil
Expand Down
4 changes: 2 additions & 2 deletions tests/test_models.py → tests/test_show.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import sys
from datetime import datetime
from package.models import display, copy_to_clipboard
from package.show import display, copy_to_clipboard

# Mock datetime class
class MockDateTime(datetime):
Expand All @@ -25,7 +25,7 @@ def read(self):


def test_display_incorrect_password(monkeypatch):
monkeypatch.setattr("package.piechart.datetime", MockDateTime) # Mock datetime
monkeypatch.setattr("package.show.datetime", MockDateTime) # Mock datetime

snippet_name = "test"
incorrect_password = "1111" # Different from "1234"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_piechart.py → tests/test_write.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shutil
import glob
from datetime import datetime
from package.piechart import plot
from package.write import plot

#we cannot mock this function, so mocking the whole class
class MockDateTime(datetime):
Expand All @@ -22,7 +22,7 @@ def mock_glob_multiple(pattern):
return ["stash/test.py", "stash/test2.py"]

def test_plot_success(monkeypatch, capfd):
monkeypatch.setattr("package.piechart.datetime", MockDateTime)
monkeypatch.setattr("package.write.datetime", MockDateTime)
monkeypatch.setattr(shutil, "copyfile", mock_copyfile)
monkeypatch.setattr(glob, "glob", mock_glob_single)

Expand All @@ -36,7 +36,7 @@ def test_plot_success(monkeypatch, capfd):


def test_plot_no_file_found(monkeypatch, capfd):
monkeypatch.setattr("package.piechart.datetime", MockDateTime)
monkeypatch.setattr("package.write.datetime", MockDateTime)
monkeypatch.setattr(glob, "glob", mock_glob_none)

snippet_name = "nonexistent"
Expand All @@ -48,7 +48,7 @@ def test_plot_no_file_found(monkeypatch, capfd):
assert "File is not found" in captured.out

def test_plot_multiple_files_found(monkeypatch, capfd):
monkeypatch.setattr("package.piechart.datetime", MockDateTime)
monkeypatch.setattr("package.write.datetime", MockDateTime)
monkeypatch.setattr(glob, "glob", mock_glob_multiple)

snippet_name = "test"
Expand Down

0 comments on commit 1e18921

Please sign in to comment.