aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-03-01 16:26:03 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-03-01 16:26:03 +0100
commitaa79c9db6674deb205c7741e11d5520c76217b8d (patch)
tree35de4f9eedaf310f83074f74c8c6444480606748 /tests
parent6848c33412a4f57ae4de6a05d27a5b767ce89fe1 (diff)
downloadminishell_test-aa79c9db6674deb205c7741e11d5520c76217b8d.tar.gz
minishell_test-aa79c9db6674deb205c7741e11d5520c76217b8d.tar.bz2
minishell_test-aa79c9db6674deb205c7741e11d5520c76217b8d.zip
Added tests for test/captured
Diffstat (limited to 'tests')
-rw-r--r--tests/test/test_captured.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/test/test_captured.py b/tests/test/test_captured.py
new file mode 100644
index 0000000..2c085c6
--- /dev/null
+++ b/tests/test/test_captured.py
@@ -0,0 +1,50 @@
+# ############################################################################ #
+# #
+# ::: :::::::: #
+# test_captured.py :+: :+: :+: #
+# +:+ +:+ +:+ #
+# By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ #
+# +#+#+#+#+#+ +#+ #
+# Created: 2021/03/01 15:55:11 by cacharle #+# #+# #
+# Updated: 2021/03/01 16:19:23 by cacharle ### ########.fr #
+# #
+# ############################################################################ #
+
+import pytest
+import copy
+
+from minishell_test.test.captured import Captured
+
+
+@pytest.fixture
+def captured():
+ return Captured("foo", 0, ["file1", "file2"], False)
+
+
+def test_init(captured):
+ assert "foo" == captured.output
+ assert 0 == captured.status
+ assert ["file1", "file2"] == captured.files_content
+ assert not captured.is_timeout
+
+
+def test_eq(captured):
+ assert captured != 42
+ assert captured != "bonjour"
+ assert captured == captured
+ c2 = copy.deepcopy(captured)
+ assert captured == c2
+ c2.output = "bar"
+ assert captured != c2
+ c2 = copy.deepcopy(captured)
+ c2.status = 42
+ assert captured != c2
+ c2 = copy.deepcopy(captured)
+ c2.files_content = ["asdfasdf"]
+ assert captured != c2
+ assert captured != Captured.timeout()
+ assert Captured.timeout() == Captured.timeout()
+
+
+def test_timeout():
+ assert Captured.timeout().is_timeout