public void DeleteKeypairTest_Delete_Keypair_Not_Exist() { var os = new OpenStackMember(UserName, Password, TenantName, TenantId); // expect ItemNotFoundException os.DeleteKeypair(InvalidItemName); }
public void DeleteKeypairTest() { var os = new OpenStackMember(UserName, Password, TenantName, TenantId); string keypairName = string.Format("keypair-key-{0}", TesterName); Assert.IsTrue(os.DeleteKeypair(keypairName)); Trace.WriteLine(String.Format("keypair deleted : {0}", DateTime.Now)); }
public void AddKeypairTest() { var os = new OpenStackMember(UserName, Password, TenantName, TenantId); // decide keypair name which is not duplicated. IEnumerable <KeypairData> keypairs = os.ListKeypairs(); IEnumerable <string> names = keypairs.GroupBy(s => s.KeyPair.Name, (key, g) => key); string[] data = Enumerable.Range(1, 100).Select(i => string.Format("keypair-key-{0}_{1}", TesterName, i)).ToArray <string>(); string keypairName = (from b in data where !names.Contains <string>(b) select b).First(); Keypair kp = os.AddKeypair(keypairName); Assert.IsNotNull(kp); Assert.IsNotNull(kp.PublicKey); Assert.IsNotNull(kp.FingerPrint); Assert.IsNotNull(kp.UserId); Trace.WriteLine(String.Format("keypair added : {0}", DateTime.Now)); Trace.WriteLine(String.Format("KeypairName : {0}", kp.Name)); // delete keypair Assert.IsTrue(os.DeleteKeypair(keypairName)); Trace.WriteLine(String.Format("keypair deleted : {0}", DateTime.Now)); }