Skip to content

Commit

Permalink
fixed test_graph.py
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-yaash committed Oct 13, 2024
1 parent 0e345fd commit d116e65
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import pytest
from package.graph import display,copy_to_clipboard
from package.graph import display
from datetime import datetime
import subprocess
from package.graph import copy_to_clipboard
import os
import sys
import shutil

def test_display_right_password():
current_time = datetime.now().strftime("%H%M")
assert display("test",current_time) is None
assert display("test",current_time) == None

def test_display_wrong_password():
with pytest.raises(ValueError, match="syntax error"):
display("test",1234)
with pytest.raises(ValueError, match="Invalid password"):
display("test", 1111)

def test_copy_to_clipboard(monkeypatch):
def mock_run(*args, **kwargs):
Expand All @@ -19,4 +23,4 @@ def mock_run(*args, **kwargs):
try:
copy_to_clipboard("Whatever test")
except Exception as e:
pytest.fail(f"Unexpected error raised: {e}")
pytest.fail("Unexpected error raised: {e}")

0 comments on commit d116e65

Please sign in to comment.