Add tests for ssh.kt
This commit is contained in:
parent
93933af0d0
commit
7e1c25fc32
1 changed files with 26 additions and 0 deletions
|
@ -0,0 +1,26 @@
|
|||
package org.domaindrivenarchitecture.provs.server.infrastructure
|
||||
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.checkFile
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileContainsText
|
||||
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
||||
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
|
||||
class SshKtTest {
|
||||
|
||||
@ExtensiveContainerTest
|
||||
fun test_configureSsh() {
|
||||
|
||||
// given
|
||||
val p = defaultTestContainer()
|
||||
|
||||
// when
|
||||
val res = p.configureSsh()
|
||||
|
||||
// then
|
||||
assertTrue(res.success)
|
||||
assertTrue(p.fileContainsText("/etc/ssh/ssh_config","PasswordAuthentication no", sudo=true))
|
||||
assertTrue(p.fileContainsText("/etc/ssh/sshd_config","PasswordAuthentication no", sudo=true))
|
||||
assertTrue(p.checkFile("/etc/ssh/sshd_config.d/sshd_hardening.conf"))
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue