Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork Sync: Update from parent repository #259

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public async Async.Task<string> Render(string templateString, Uri instanceUrl, b
true => new TemplateContext {
EnableRelaxedFunctionAccess = false,
EnableRelaxedIndexerAccess = false,
EnableRelaxedMemberAccess = false,
EnableRelaxedMemberAccess = true,
EnableRelaxedTargetAccess = false
},
_ => new TemplateContext()
Expand Down
21 changes: 21 additions & 0 deletions src/ApiService/IntegrationTests/JinjaToScribanMigrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ public async Async.Task Access_WithoutAuthorization_IsRejected() {
result.StatusCode.Should().Be(System.Net.HttpStatusCode.BadRequest);
}

[Fact]
public async Async.Task Do_Not_Enforce_Key_Exists_In_Strict_Validation() {
(await JinjaTemplateAdapter.IsValidScribanNotificationTemplate(Context, Logger, ValidScribanAdoTemplate()))
.Should().BeTrue();
}

private async Async.Task ConfigureAuth() {
await Context.InsertAll(
new InstanceConfig(Context.ServiceConfiguration.OneFuzzInstanceName!) { Admins = new[] { _userObjectId } } // needed for admin check
Expand Down Expand Up @@ -412,4 +418,19 @@ private static GithubIssuesTemplate MigratableGithubTemplate() {
private static TeamsTemplate GetTeamsTemplate() {
return new TeamsTemplate(new SecretData<string>(new SecretValue<string>("https://example.com")));
}

private static AdoTemplate ValidScribanAdoTemplate() {
return new AdoTemplate(
new Uri("http://example.com"),
new SecretData<string>(new SecretValue<string>("some secret")),
"{{ if task.tags.project }} blah {{ end }}",
string.Empty,
Array.Empty<string>().ToList(),
new Dictionary<string, string>(),
new ADODuplicateTemplate(
Array.Empty<string>().ToList(),
new Dictionary<string, string>(),
new Dictionary<string, string>()
));
}
}