[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-179-g853b278

Shawn Moore sartak at bestpractical.com
Mon Jul 19 18:51:18 EDT 2010


The branch, new-style-templates has been updated
       via  853b27898ad04239c3e26df2c7b390b62b9b1a42 (commit)
      from  2842cdc044ab5b4687d7c04beac3bea5bd340734 (commit)

Summary of changes:
 t/api/template-simple.t |   81 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 80 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 853b27898ad04239c3e26df2c7b390b62b9b1a42
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Jul 19 18:52:58 2010 -0400

    Tests for simple templates

diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index ec274ae..4ee8cc9 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 use RT;
-use RT::Test tests => 16;
+use RT::Test tests => 37;
 
 my $ticket = RT::Ticket->new($RT::SystemUser);
 my ($id, $msg) = $ticket->Create(
@@ -21,6 +21,10 @@ ok($id, 'Created ticket');
     ok($t->id, "Created template");
     is($t->Name, "Foo");
     is($t->Content, "\ntest");
+    TODO: {
+        local $TODO = "template types not settled";
+        is($t->Type, "Full");
+    }
 
     my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
     ok($ok, $msg);
@@ -37,6 +41,10 @@ ok($id, 'Created ticket');
     ok($t->id, "Created template");
     is($t->Name, "Foo");
     is($t->Content, "\ntest { 5 * 5 }");
+    TODO: {
+        local $TODO = "template types not settled";
+        is($t->Type, "Full");
+    }
 
     my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
     ok($ok, $msg);
@@ -53,6 +61,77 @@ ok($id, 'Created ticket');
     ok($t->id, "Created template");
     is($t->Name, "Foo");
     is($t->Content, "\ntest { \$Requestor }");
+    TODO: {
+        local $TODO = "template types not settled";
+        is($t->Type, "Full");
+    }
+
+    my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
+    ok($ok, $msg);
+    is($t->MIMEObj->stringify_body, "test dom\@example.com");
+}
+
+# no interpolation
+{
+    my $t = RT::Template->new($RT::SystemUser);
+    $t->Create(
+        Name    => "Foo",
+        Content => "\ntest",
+        Type    => "Simple",
+    );
+    ok($t->id, "Created template");
+    is($t->Name, "Foo");
+    is($t->Content, "\ntest");
+    TODO: {
+        local $TODO = "template types not settled";
+        is($t->Type, "Simple");
+    }
+
+    my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
+    ok($ok, $msg);
+    is($t->MIMEObj->stringify_body, "test");
+}
+
+# code interpolation
+{
+    my $t = RT::Template->new($RT::SystemUser);
+    $t->Create(
+        Name => "Foo",
+        Content => "\ntest { 5 * 5 }",
+        Type => "Simple",
+    );
+    ok($t->id, "Created template");
+    is($t->Name, "Foo");
+    is($t->Content, "\ntest { 5 * 5 }");
+    TODO: {
+        local $TODO = "template types not settled";
+        is($t->Type, "Simple");
+    }
+
+    my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
+    ok($ok, $msg);
+
+    TODO: {
+        local $TODO = "simple templates not yet implemented";
+        is($t->MIMEObj->stringify_body, "test { 5 * 5 }");
+    }
+}
+
+# variable interpolation
+{
+    my $t = RT::Template->new($RT::SystemUser);
+    $t->Create(
+        Name => "Foo",
+        Content => "\ntest { \$Requestor }",
+        Type => "Simple",
+    );
+    ok($t->id, "Created template");
+    is($t->Name, "Foo");
+    is($t->Content, "\ntest { \$Requestor }");
+    TODO: {
+        local $TODO = "template types not settled";
+        is($t->Type, "Simple");
+    }
 
     my ($ok, $msg) = $t->Parse(TicketObj => $ticket);
     ok($ok, $msg);

-----------------------------------------------------------------------


More information about the Rt-commit mailing list