mirror of
https://github.com/bitwarden/server
synced 2026-01-04 01:23:25 +00:00
Add template properties for Datadog (#6528)
* Add template properites for Datadog * Add test and implementation for including User and ActingUser when only the Type is referenced * Refactored database calls to fetch the user details in a single DB call * Refactor to use a dedicated stored procedure for Dapper * Remove TOP 1 from stored procedure * Accept Claude's optimization of SingleOrDefaultAsync to unify Dapper/EF Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * Revert earlier change and add TOP 1 back into stored procedure * Change go to GO * Revert back to version that assumes uniqueness, remove TOP 1 --------- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
This commit is contained in:
@@ -83,6 +83,7 @@ public class IntegrationTemplateProcessorTests
|
||||
[Theory]
|
||||
[InlineData("User name is #UserName#")]
|
||||
[InlineData("Email: #UserEmail#")]
|
||||
[InlineData("User type = #UserType#")]
|
||||
public void TemplateRequiresUser_ContainingKeys_ReturnsTrue(string template)
|
||||
{
|
||||
var result = IntegrationTemplateProcessor.TemplateRequiresUser(template);
|
||||
@@ -102,6 +103,7 @@ public class IntegrationTemplateProcessorTests
|
||||
[Theory]
|
||||
[InlineData("Acting user is #ActingUserName#")]
|
||||
[InlineData("Acting user's email is #ActingUserEmail#")]
|
||||
[InlineData("Acting user's type is #ActingUserType#")]
|
||||
public void TemplateRequiresActingUser_ContainingKeys_ReturnsTrue(string template)
|
||||
{
|
||||
var result = IntegrationTemplateProcessor.TemplateRequiresActingUser(template);
|
||||
@@ -118,6 +120,25 @@ public class IntegrationTemplateProcessorTests
|
||||
Assert.False(result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Group name is #GroupName#!")]
|
||||
[InlineData("Group: #GroupName#")]
|
||||
public void TemplateRequiresGroup_ContainingKeys_ReturnsTrue(string template)
|
||||
{
|
||||
var result = IntegrationTemplateProcessor.TemplateRequiresGroup(template);
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("#GroupId#")] // This is on the base class, not fetched, so should be false
|
||||
[InlineData("No Group Tokens")]
|
||||
[InlineData("")]
|
||||
public void TemplateRequiresGroup_EmptyInputOrNoMatchingKeys_ReturnsFalse(string template)
|
||||
{
|
||||
var result = IntegrationTemplateProcessor.TemplateRequiresGroup(template);
|
||||
Assert.False(result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Organization: #OrganizationName#")]
|
||||
[InlineData("Welcome to #OrganizationName#")]
|
||||
|
||||
Reference in New Issue
Block a user