[Bps-public-commit] rt-extension-rest2 branch, update-custom-roles-on-correspond-and-comment, repushed
Dianne Skoll
dianne at bestpractical.com
Mon Dec 14 14:56:47 EST 2020
The branch update-custom-roles-on-correspond-and-comment was deleted and repushed:
was e0798810bf8bf20f1d11e69d1d825be4f3f9e713
now 5241bba915dd66946408c14cc3768ec2c8d2c733
1: e476923 < -: ------- Allow custom role updates via the correspond and comment endpoints.
-: ------- > 1: c248e5b Move _update_role_members out of RT::Extension::REST2::Resource::Record::Writable and into RT::Extension::REST2::Util
-: ------- > 2: 6878489 Allow updating of custom roles on ticket comment/correspond.
2: 95f2e43 ! 3: 5241bba Add unit test for updating custom roles on ticket comment/correspond.
@@ -1,6 +1,6 @@
Author: Dianne Skoll <dianne at bestpractical.com>
- Add unit test for new feature: Allow custom role updates via the correspond and comment endpoints
+ Add unit test for updating custom roles on ticket comment/correspond.
diff --git a/xt/ticket-correspond-update-customroles.t b/xt/ticket-correspond-update-customroles.t
new file mode 100644
@@ -126,7 +126,7 @@
+ # Because CustomRoles are set in an unpredictable order, sort the
+ # responses so we have a predictable order.
+ @$content = sort { $a cmp $b } (@$content);
-+ cmp_deeply($content, ["Added quux\@cabbage.example to 'Multi Member'", re(qr/Correspondence added|Message recorded/), "Set 'Single Member' to foo\@bar.example"]);
++ cmp_deeply($content, ['Added quux at cabbage.example as Multi Member for this ticket', re(qr/Correspondence added|Message recorded/), 'Single Member changed from Nobody to foo at bar.example']);
+ like($res->header('Location'), qr{$rest_base_path/transaction/\d+$});
+ $res = $mech->get($res->header('Location'),
+ 'Authorization' => $auth,
@@ -171,7 +171,7 @@
+
+ is($ticket->RoleAddresses("RT::CustomRole-$single_id"), 'foo-new at bar.example',
+ "Single Member role set correctly");
-+ is($ticket->RoleAddresses("RT::CustomRole-$multi_id"), 'quux-new at cabbage.example, quux at cabbage.example',
++ is($ticket->RoleAddresses("RT::CustomRole-$multi_id"), 'quux-new at cabbage.example',
+ "Multi Member role updated correctly");
+
+ # Supply an array for multi-member role
@@ -207,7 +207,7 @@
+
+ is($ticket->RoleAddresses("RT::CustomRole-$single_id"), 'foo-new at bar.example',
+ "Single Member role unchanged");
-+ is($ticket->RoleAddresses("RT::CustomRole-$multi_id"), 'abacus at example.com, quux-new at cabbage.example',
++ is($ticket->RoleAddresses("RT::CustomRole-$multi_id"), 'abacus at example.com',
+ "Multi Member role unchanged");
+
+ # Supply an array for single-member role
@@ -223,11 +223,10 @@
+ );
+ is($res->code, 201);
+ $content = $mech->json_response;
-+ cmp_deeply($content, ['Correspondence added', "Expecting a single string for single-valued role 'Single Member'"], "Got expected respose");
-+ is($ticket->RoleAddresses("RT::CustomRole-$single_id"), 'foo-new at bar.example',
-+ "Single Member role unchanged");
++ cmp_deeply($content, ['Correspondence added', 'Single Member changed from foo-new at bar.example to abacus at example.com'], "Got expected respose");
++ is($ticket->RoleAddresses("RT::CustomRole-$single_id"), 'abacus at example.com',
++ "Single Member role changed to first member of array");
+
+}
+
+done_testing;
-
3: e079881 < -: ------- Always set multi-member custom roles to supplied address(es) rather than adding a watcher if a single address is given.
More information about the Bps-public-commit
mailing list