public void TestEnrollReqToJsonAttrNotThere() { EnrollmentRequest testEnrollReq = new EnrollmentRequest(); testEnrollReq.AddHost("d.com"); testEnrollReq.CSR = csr; testEnrollReq.Profile = profile; testEnrollReq.Label = label; testEnrollReq.KeyPair = null; testEnrollReq.CAName = caName; string s = testEnrollReq.ToJson(); Assert.IsNotNull(s); Assert.IsFalse(s.Contains("\"attr_reqs\":[")); }
public void TestEnrollReqToJsonAttrEmpty() { EnrollmentRequest testEnrollReq = new EnrollmentRequest(); testEnrollReq.AddHost("d.com"); testEnrollReq.CSR = csr; testEnrollReq.Profile = profile; testEnrollReq.Label = label; testEnrollReq.KeyPair = null; testEnrollReq.CAName = caName; testEnrollReq.AddAttrReq(); // means empty. force no attributes. string s = testEnrollReq.ToJson(); Assert.IsNotNull(s); Assert.IsTrue(s.Contains("\"attr_reqs\":[]") || !s.Contains("\"attr_reqs\"")); }
public void TestEnrollReqToJson() { try { EnrollmentRequest testEnrollReq = new EnrollmentRequest(); testEnrollReq.AddHost("d.com"); testEnrollReq.CSR = csr; testEnrollReq.Profile = profile; testEnrollReq.Label = label; testEnrollReq.KeyPair = null; testEnrollReq.CAName = caName; Assert.IsTrue(testEnrollReq.ToJson().Contains(csr)); } catch (System.Exception e) { Assert.Fail($"Unexpected Exception {e.Message}"); } }
public void TestEnrollReqToJsonAttr() { EnrollmentRequest testEnrollReq = new EnrollmentRequest(); testEnrollReq.AddHost("d.com"); testEnrollReq.CSR = csr; testEnrollReq.Profile = profile; testEnrollReq.Label = label; testEnrollReq.KeyPair = null; testEnrollReq.CAName = caName; testEnrollReq.AddAttrReq("foo"); testEnrollReq.AddAttrReq("foorequired").SetOptional(false); testEnrollReq.AddAttrReq("foofalse").SetOptional(true); string s = testEnrollReq.ToJson(); Assert.IsNotNull(s); Console.WriteLine(s); Assert.IsTrue(s.Contains("\"attr_reqs\":[")); Assert.IsTrue(s.Contains("\"name\":\"foorequired\",\"optional\":false")); Assert.IsTrue(s.Contains("\"name\":\"foofalse\",\"optional\":true")); }