[Bps-public-commit] rt-extension-rest2 02/02: Add tests for custom roles on ticket create

Jim Brandt jbrandt at bestpractical.com
Fri Aug 6 15:10:45 UTC 2021


This is an automated email from the git hooks/post-receive script.

jbrandt pushed a commit to branch custom-roles-on-create
in repository rt-extension-rest2.

commit e9b0208bf21f8981ead634590ee30e2325b5e43b
Author: Jim Brandt <jbrandt at bestpractical.com>
AuthorDate: Fri Aug 6 11:06:03 2021 -0400

    Add tests for custom roles on ticket create
---
 xt/ticket-customroles.t | 42 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/xt/ticket-customroles.t b/xt/ticket-customroles.t
index 4b8b2e4..51cf4f6 100644
--- a/xt/ticket-customroles.t
+++ b/xt/ticket-customroles.t
@@ -200,6 +200,46 @@ $user->PrincipalObj->GrantRight( Right => $_ )
     }, 'one Single Member');
 }
 
+diag 'Create and view ticket with custom roles by name';
+{
+    my $payload = {
+        Subject   => 'Ticket with multiple watchers',
+        Queue     => 'General',
+        CustomRoles => { 'Multi Member' => ['multi at example.com', 'multi2 at example.com'],
+                         'Single Member' => 'test at localhost' },
+    };
+
+    my $res = $mech->post_json("$rest_base_path/ticket",
+        $payload,
+        'Authorization' => $auth,
+    );
+    is($res->code, 201);
+    ok(my $ticket_url = $res->header('location'));
+    ok((my $ticket_id) = $ticket_url =~ qr[/ticket/(\d+)]);
+
+    $res = $mech->get($ticket_url,
+        'Authorization' => $auth,
+    );
+    is($res->code, 200);
+
+    my $content = $mech->json_response;
+    cmp_deeply($content->{$multi->GroupType}, [{
+        type => 'user',
+        id   => 'multi at example.com',
+        _url => re(qr{$rest_base_path/user/multi\@example\.com$}),
+    }, {
+        type => 'user',
+        id   => 'multi2 at example.com',
+        _url => re(qr{$rest_base_path/user/multi2\@example\.com$}),
+    }], 'two Multi Members');
+
+    cmp_deeply($content->{$single->GroupType}, {
+        type => 'user',
+        id   => 'test at localhost',
+        _url => re(qr{$rest_base_path/user/test\@localhost}),
+    }, 'one Single Member');
+}
+
 # Modify single-member role
 {
     my $payload = {
@@ -368,7 +408,7 @@ $user->PrincipalObj->GrantRight( Right => $_ )
     my @stable_payloads = (
     {
         Subject => 'no changes to watchers',
-        _messages => ["Ticket 5: Subject changed from 'Ticket for modifying watchers' to 'no changes to watchers'"],
+        _messages => ["Ticket 6: Subject changed from 'Ticket for modifying watchers' to 'no changes to watchers'"],
         _name => 'no watcher keys',
     },
     {

-- 
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.


More information about the Bps-public-commit mailing list