news-test-procs.tcl

Test cases for the Tcl API of the news package. The test cases are based on the acs-automated-testing package

Location:
packages/news/tcl/test/news-test-procs.tcl
Created:
2nd October 2003
Author:
Peter Marklund
CVS Identification:
$Id: news-test-procs.tcl,v 1.5.2.1 2020/02/11 19:37:48 hectorr Exp $

Procedures in this file

Detailed information

_news__news_pretty_status (private)

 _news__news_pretty_status

Partial Call Graph (max 5 caller/called nodes):
%3 aa_log aa_log (public) aa_log_result aa_log_result (public) news::test::assert_status_pretty news::test::assert_status_pretty (private) _news__news_pretty_status _news__news_pretty_status _news__news_pretty_status->aa_log _news__news_pretty_status->aa_log_result _news__news_pretty_status->news::test::assert_status_pretty

Testcases:
No testcase defined.

news::test::assert_status_pretty (private)

 news::test::assert_status_pretty -publish_date publish_date \
    -archive_date archive_date -status status
Switches:
-publish_date (required)
-archive_date (required)
-status (required)

Partial Call Graph (max 5 caller/called nodes):
%3 aa_equals aa_equals (public) aa_true aa_true (public) news::test::get_news_status news::test::get_news_status (private) news_pretty_status news_pretty_status (public) news::test::assert_status_pretty news::test::assert_status_pretty news::test::assert_status_pretty->aa_equals news::test::assert_status_pretty->aa_true news::test::assert_status_pretty->news::test::get_news_status news::test::assert_status_pretty->news_pretty_status

Testcases:
No testcase defined.

news::test::get_news_status (private)

 news::test::get_news_status -publish_date publish_date \
    -archive_date archive_date
Switches:
-publish_date (required)
-archive_date (required)

Partial Call Graph (max 5 caller/called nodes):
%3 news::test::assert_status_pretty news::test::assert_status_pretty (private) news::test::get_news_status news::test::get_news_status news::test::assert_status_pretty->news::test::get_news_status db_string db_string (public) news::test::get_news_status->db_string

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

ad_library {
  Test cases for the Tcl API of the news package. The test cases are based
  on the acs-automated-testing package

  @author Peter Marklund
  @creation-date 2nd October 2003
  @cvs-id $Id: news-test-procs.tcl,v 1.5.2.1 2020/02/11 19:37:48 hectorr Exp $
}

namespace eval news {}
namespace eval news::test {}

aa_register_case \
    -procs news_pretty_status \
    news_pretty_status {
        Test the news_pretty_status Tcl proc and
        the news__status PLSQL function.

        @author Peter Marklund
} {
    set now_seconds [clock scan now]
    set offset [expr {60*60*24*10}]
    set date_format "%Y-%m-%d"
    set future_seconds [expr {$now_seconds + $offset}]
    set future_date [clock format $future_seconds -format $date_format]
    set past_seconds [expr {$now_seconds - $offset}]
    set past_date [clock format $past_seconds -format $date_format]

    # Scheduled for publish, no archive
    news::test::assert_status_pretty \
        -publish_date $future_date \
        -archive_date "" \
        -status going_live_no_archive

    # Scheduled for publish and archive
    news::test::assert_status_pretty \
        -publish_date $future_date \
        -archive_date $future_date \
        -status going_live_with_archive

    # Published, no archive
    news::test::assert_status_pretty \
        -publish_date $past_date \
        -archive_date "" \
        -status published_no_archive

    # Published scheduled archived
    news::test::assert_status_pretty \
        -publish_date $past_date \
        -archive_date $future_date \
        -status published_with_archive

    # Published and archived
    news::test::assert_status_pretty \
        -publish_date $past_date \
        -archive_date $past_date \
        -status archived

    # Not scheduled for publish
    news::test::assert_status_pretty \
        -publish_date "" \
        -archive_date "" \
        -status unapproved
}

d_proc -private news::test::assert_status_pretty {
    {-publish_date:required}
    {-archive_date:required}
    {-status:required}
} {
    set pretty_status [news_pretty_status -publish_date $publish_date -archive_date $archive_date -status $status]
    aa_true "publish_date=\"$publish_date\" archive_date=\"$archive_date\" status=\"$status\" pretty_status=\"$pretty_status\"" \
        [expr {$pretty_status ne ""}]

    set db_news_status [news::test::get_news_status \
                           -publish_date $publish_date \
                           -archive_date $archive_date]
    aa_equals "publish_date=\"$publish_date\" archive_date=\"$archive_date\"" $db_news_status $status
}

d_proc -private news::test::get_news_status {
    {-publish_date:required}
    {-archive_date:required}
} {
    return [db_string select_status {}]
}

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: