From 814ebac5f68709484af98568f5005a0f76c84c51 Mon Sep 17 00:00:00 2001 From: George Trifonov Date: Mon, 19 Jan 2015 10:21:05 -0800 Subject: [PATCH] Addressing unit tests cr feedback --- .../Templates/TokenRestrictionTemplate.cs | 3 +-- test/net/unit/TokenRestrictionTemplateSerializerTests.cs | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/net/Client/ContentKeyAuthorization/Templates/TokenRestrictionTemplate.cs b/src/net/Client/ContentKeyAuthorization/Templates/TokenRestrictionTemplate.cs index a7a7a7c3..11a34b0c 100644 --- a/src/net/Client/ContentKeyAuthorization/Templates/TokenRestrictionTemplate.cs +++ b/src/net/Client/ContentKeyAuthorization/Templates/TokenRestrictionTemplate.cs @@ -37,8 +37,7 @@ public TokenRestrictionTemplate() public TokenRestrictionTemplate(TokenType tokenType) { TokenType = tokenType; - RequiredClaims = new List(); - AlternateVerificationKeys = new List(); + InitCollections(); } [OnDeserializing] diff --git a/test/net/unit/TokenRestrictionTemplateSerializerTests.cs b/test/net/unit/TokenRestrictionTemplateSerializerTests.cs index fe523111..b73c63e6 100644 --- a/test/net/unit/TokenRestrictionTemplateSerializerTests.cs +++ b/test/net/unit/TokenRestrictionTemplateSerializerTests.cs @@ -47,7 +47,8 @@ public void RoundTripTest() TokenRestrictionTemplate template2 = TokenRestrictionTemplateSerializer.Deserialize(serializedTemplate); Assert.IsNotNull(template2); Assert.AreEqual(template.Issuer, template2.Issuer); - Assert.AreEqual(template.Audience, template2.Audience); + Assert.AreEqual(template.Audience, template2.Audience); + Assert.AreEqual(template.TokenType, TokenType.SWT); SymmetricVerificationKey fromTemplate = (SymmetricVerificationKey) template.PrimaryVerificationKey; SymmetricVerificationKey fromTemplate2 = (SymmetricVerificationKey) template2.PrimaryVerificationKey; @@ -56,7 +57,7 @@ public void RoundTripTest() } [TestMethod] - public void KnownGoodInputForObsoleteScheme() + public void KnownGoodInputForSwtOnlyScheme() { string tokenTemplate = "GG07fDPZ+HMD2vcoknMqYjEJMb7LSq8zUmdCYMvRCevnQK//ilbhODO/FydMrHiwZGmI6XywvOOU7SSzRPlI3Q==http://sampleaudience/http://sampleissuerurl/2OvxltHKwILn5PCRD8H+63sK98LBs1yF+ZdZbwzmToWYm29pLyqIMuCvMRGpLOv5DYh3NmpzWMAciu4ncW8VTg==urn:microsoft:azure:mediaservices:contentkeyidentifierurn:myservice:claims:rentaltrue"; @@ -77,7 +78,7 @@ public void KnownGoodInputForJWT() [TestMethod] public void KnownGoodInputForSWT() { - string tokenTemplate = "http://sampleissuerurl/http://sampleaudience/MIIDAzCCAeugAwIBAgIQ2cl0q8oGkaFG+ZTZYsilhDANBgkqhkiG9w0BAQ0FADARMQ8wDQYDVQQDEwZDQVJvb3QwHhcNMTQxMjAxMTg0NzI5WhcNMzkxMjMxMjM1OTU5WjARMQ8wDQYDVQQDEwZDQVJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDjgMbtZcLtKNdJXHSGQ7l6xJBtNCVhjF4+BLZq+D2RmubKTAnGXhNGY4FO2LrPjfkWumdnv5DOlFuwHy2qrsZu1TFZxxQzU9/Yp3VAD1Afk7ShUOxniPpIO9vfkUH+FEX1Taq4ncR/TkiwnIZLy+bBa0DlF2MsPGC62KbiN4xJqvSIuecxQvcN8MZ78NDejtj1/XHF7VBmVjWi5B79GpTvY9ap39BU8nM0Q8vWb9DwmpWLz8j7hm25f+8laHIE6U8CpeeD/OrZT8ncCD0hbhR3ZGGoFqJbyv2CLPVGeaIhIxBH41zgrBYR53NjkRLTB4IEUCgeTGvSzweqlb+4totdAgMBAAGjVzBVMA8GA1UdEwEB/wQFMAMBAf8wQgYDVR0BBDswOYAQSHiCUWtQlUe79thqsTDbbqETMBExDzANBgNVBAMTBkNBUm9vdIIQ2cl0q8oGkaFG+ZTZYsilhDANBgkqhkiG9w0BAQ0FAAOCAQEABa/2D+Rxo6tp63sDFRViikNkDa5GFZscQLn4Rm35NmUt35Wc/AugLaTJ7iP5zJTYIBUI9DDhHbgFqmYpW0p14NebJlBzrRFIaoHBOsHhy4VYrxIB8Q/OvSGPgbI2c39ni/odyTYKVtJacxPrIt+MqeiFMjJ19cJSOkKT2AFoPMa/L0++znMcEObSAHYMy1U51J1njpQvNJ+MQiR8y2gvmMbGEcMgicIJxbLB2imqJWCQkFUlsrxwuuzSvNaLkdd/HyhsR1JXc+kOREO8gWjhT6MAdgGKC9+neamR7sqwJHPNfcLYTDFOhi6cJH10z74mU1Xa5uLsX+aZp2YYHUFw4Q==SWT"; + string tokenTemplate = "http://sampleissuerurl/http://sampleaudience/2OvxltHKwILn5PCRD8H+63sK98LBs1yF+ZdZbwzmToWYm29pLyqIMuCvMRGpLOv5DYh3NmpzWMAciu4ncW8VTg==urn:microsoft:azure:mediaservices:contentkeyidentifierurn:myservice:claims:rentaltrueSWT"; TokenRestrictionTemplate template = TokenRestrictionTemplateSerializer.Deserialize(tokenTemplate); Assert.IsNotNull(template); Assert.AreEqual(TokenType.SWT, template.TokenType);