From 31923e9a098910f7c69fd1fcd933c4b6731371ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sara=20Aim=C3=A9e=20Smiseth?= <51710585+SaraSmiseth@users.noreply.github.com> Date: Thu, 8 Oct 2020 17:43:14 +0200 Subject: [PATCH] wip tests 8 --- tests/test.zsh | 5 ----- tests/tests.bats | 14 +++++++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/test.zsh b/tests/test.zsh index 9baaac7..8aa6cc2 100755 --- a/tests/test.zsh +++ b/tests/test.zsh @@ -37,9 +37,4 @@ sudo docker-compose down \ && sleep 1 \ && ./bats/bats-core/bin/bats tests.bats -#&& sudo docker-compose logs | grep "message to" \ -#&& sudo docker-compose logs | grep "type='error'" -# Received[c2s]: -# Should be five times in log - sudo docker-compose down diff --git a/tests/tests.bats b/tests/tests.bats index 218487e..00df7e8 100644 --- a/tests/tests.bats +++ b/tests/tests.bats @@ -1,8 +1,16 @@ +# For tests with pipes see: https://github.com/sstephenson/bats/issues/10 + load 'bats/bats-support/load' load 'bats/bats-assert/load' -@test "TODO write test" { - run false +@test "Should send 5 messages" { + run bash -c "sudo docker-compose logs | grep \"Received\[c2s\]: \" | wc -l" assert_success - assert_output "TODO" + assert_output "5" +} + +@test "Should log error for user with wrong password" { + run bash -c "sudo docker-compose logs | grep \"Session closed by remote with error: undefined-condition (user intervention: authentication failed: authentication aborted by user)\"" + assert_success + assert_output }