044238e6b3cbcce7f24f1ec1a2e35b7a3a33984c

Author
Nick Cross <ncross@redhat.com>
Committer
Michael Aquilina <michaelaquilina@gmail.com>
Date

Message

Add test.

Diff

 1diff --git a/tests/test_rmvenv.zunit b/tests/test_rmvenv.zunit
 2index fdce5fa59c46cc445f442c98687d22ebfde9815f..0e1b51df1ebc7c34fce96e0212e4824a95a496b8 100644
 3--- a/tests/test_rmvenv.zunit
 4+++ b/tests/test_rmvenv.zunit
 5@@ -36,6 +36,23 @@
 6     test ! -d "$HOME/.virtualenvs/12345"
 7 }
 8 
 9+@test 'rmvenv - removes .venv if present with function' {
10+    # lightweight simulation of creating a virtualenv
11+    mkdir -p "$HOME/.virtualenvs/54321"
12+
13+    echo "54321" > .venv
14+
15+    # Interfere with rm executable (in normal use alias or function would do the same).
16+    function rm(){ : }
17+
18+    run rmvenv
19+
20+    assert $state equals 0
21+    assert "$output" same_as "Removing \e[35m54321\e[0m..."
22+    test ! -f .venv
23+    test ! -d "$HOME/.virtualenvs/54321"
24+}
25+
26 @test 'rmvenv - removes .venv and deactivates if currently active' {
27     test_venv="$(basename $PWD)"
28     run mkvenv