Skip to content

Commit

Permalink
Test invalid Azure DNS host name
Browse files Browse the repository at this point in the history
verify wildcard
  • Loading branch information
ohadschn committed Feb 15, 2020
1 parent 0a56e1b commit a4afd1e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ public void InvalidHosts()
AssertInvalidParameter("-o", "/", "hosts");
}

[TestMethod]
public void TestInvalidAzureDnsHosts()
{
AssertInvalidParameters(
CompleteArgs(new[]
{
"-o", "www.example.com",
"--azureDnsZoneName", "example.com",
"--azureDnsRelativeRecordSetName", "www",
}), "wildcard");
}

[TestMethod]
public void InvalidEmail()
{
Expand Down Expand Up @@ -150,9 +162,14 @@ public void InvalidAzureDnsRelativeRecordSetName()
}

private void AssertInvalidParameter(string name, string value, params string[] expectedTexts)
{
AssertInvalidParameters(CompleteArgs(new[] { name, value }), expectedTexts);
}

private void AssertInvalidParameters(string[] args, params string[] expectedTexts)
{
AssertExtensions.Throws<ArgumentException>(
() => m_renewer.Renew(CompleteArgs(new[] { name, value })),
() => m_renewer.Renew(args),
e => expectedTexts.All(t => e.Message.Contains(t)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ public void TestInvalidHosts()
AssertInvalidConfig(HostsKeySuffix, WebApp2, "www.foo.com;not/valid", "hosts", testMissing: false, testShared: false);
}

[TestMethod]
public void TestInvalidAzureDnsHosts()
{
AssertInvalidConfig(HostsKeySuffix, WebApp1, "www.foo.com", "wildcard", testMissing: false, testShared: false);
}

[TestMethod]
public void TestInvalidEmail()
{
Expand Down

0 comments on commit a4afd1e

Please sign in to comment.