From ab9013d8e6515a28a07cd491361830cde3657d63 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 2 Jun 2021 17:41:04 +0100 Subject: [PATCH] sshkeys: Test banner and static handling Signed-off-by: Ian Jackson --- apitest/at-otter.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index 1bdb05f0..292bfe34 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -211,13 +211,27 @@ impl Ctx { )?); self.otter(&command)?; - let dummy_key_path = ds.subst("@src@/apitest/dummy.pub")?; - let ds = ds.also(&[("dummy_key_path", &dummy_key_path)]); + let ds = ds.also(&[ + ("dummy_key_path", ds.subst("@src@/apitest/dummy.pub")?), + ("authkeys", ds.subst("@abstmp@/authorized_keys")?), + ]); + + static STATIC_TEST: &str = "# example static data -- for test\n"; - self.otter(&ds.gss( + File::create(ds.subst("@authkeys@")?)? + .write(STATIC_TEST.as_bytes())?; + + let set_keys = ds.gss( "--super --account ssh:test: set-ssh-keys \ @dummy_key_path@" - )?)?; + )?; + + self.otter(&set_keys).expect_err("auth keys has static"); + + fs::rename(ds.subst("@authkeys@")?, + ds.subst("@authkeys@.static")?)?; + + self.otter(&set_keys)?; } } -- 2.30.2