~noskcaj/ubuntu/saucy/dhelp/apache2.4

« back to all changes in this revision

Viewing changes to test/tc_dhelpdocumentpool.rb

  • Committer: Charlie Smotherman
  • Date: 2012-11-05 23:48:50 UTC
  • mfrom: (22.1.1 dhelp)
  • Revision ID: cjsmo@cableone.net-20121105234850-4a447ob81bs9a5je
Tags: 0.6.21+nmu1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - lib/dhelp.rb:
    + Exit and return zero code if bdb isn't available; this usually
      indicates that dhelp is not configured yet.
* Non-Maintainer Upload
* Dropped the declaration of dependence on ruby-commandline, which was
  already done on the code
* New maintainer: Georgios M. Zarkadas <gz@member.fsf.org> (Closes: #650441). 
* Support other web servers in addition to apache2 (Closes: #669041).
* Support apache2 packaging transition for version 2.4 (Closes: #669758).
* Support new ruby packaging policy transition for Wheezy.
* Use OptionParser instead Commandline::Application (Closes: #678055).
  Thanks Gunnar Wolf.
* Support new layout of man2html cgi scripts for Wheezy.
* Keep supporting previous policies/layouts, either during build time or
  during runtime, to aid backporting.
* Man and info pages links are activated only if associated packages are
  installed on the system.
* Subsections now show in the sections list only if section is selected.
* New color, styles and icons themes.
* Package installation now does not fail if cache data cannot be generated
  during install.
* Fix some minor lintian warnings.
* Bump Standards-Version to 3.9.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
require 'fileutils'
4
4
 
5
5
class TC_DhelpDocumentPool < Test::Unit::TestCase
 
6
 
 
7
  TEST_DOC_BASE_DIR     = 'test/doc-base-pool'
6
8
  TEST_DOC_DIR_DATABASE = 'test/dddb'
7
9
  TEST_INDEX_FILE       = 'test/index.swish++'
8
10
  TEST_PENDING_FILE     = 'test/pending.list'
 
11
  TEST_INDEXER_CONFIG   = 'config/swish++.conf'
9
12
 
10
13
  def doc_base_document(path)
11
 
    Dhelp::DocBaseDocument.new("test/doc-base-pool/#{path}")
 
14
    Dhelp::DocBaseDocument.new(TEST_DOC_BASE_DIR + "/#{path}")
12
15
  end
13
16
 
14
17
  def doc_id_set_in_pool(pool)
20
23
  end
21
24
 
22
25
  def setup
23
 
    @pool = Dhelp::DhelpDocumentPool.new(:doc_base_dir => ['test/doc-base-pool'],
24
 
                                         :doc_dir_database => TEST_DOC_DIR_DATABASE,
25
 
                                         :index_file       => TEST_INDEX_FILE,
26
 
                                         :indexer_config_file => 'swish++.conf',
27
 
                                         :pending_file     => TEST_PENDING_FILE)
 
26
    @pool = Dhelp::DhelpDocumentPool.new(
 
27
              :doc_base_dir         => [TEST_DOC_BASE_DIR],
 
28
              :doc_dir_database     => TEST_DOC_DIR_DATABASE,
 
29
              :index_file           => TEST_INDEX_FILE,
 
30
              :indexer_config_file  => TEST_INDEXER_CONFIG,
 
31
              :pending_file         => TEST_PENDING_FILE
 
32
              )
28
33
    @doc_base_id_set = Set.new(['docbook-xsl-doc-html',
29
34
                                'pica-manual',
30
35
                                'pica-manual-2'])
37
42
  def test_deregistration
38
43
    deregistered_docs = ['pica-manual']
39
44
    deregistered_docs.each do |doc|
40
 
      @pool.deregister("test/doc-base-pool/#{doc}")
 
45
      @pool.deregister(TEST_DOC_BASE_DIR + "/#{doc}")
41
46
    end
42
47
    assert_equal @doc_base_id_set - deregistered_docs,
43
48
      doc_id_set_in_pool(@pool)
109
114
 
110
115
  def test_rebuild_dirs
111
116
    # 1) Create a temporary directory with some documents
112
 
    tmp_dir    = 'test/tmp/doc-base-pool'
113
 
    dddb       = 'test/tmp/doc-base_dirs'
114
 
    index_file = 'test/tmp/index'
 
117
    tmp_dir     = 'test/tmp/doc-base-pool'
 
118
    dddb        = 'test/tmp/doc-base_dirs'
 
119
    index_file  = 'test/tmp/index'
 
120
    config_file = TEST_INDEXER_CONFIG
115
121
    FileUtils.mkdir_p tmp_dir
116
122
    FileUtils.cp 'test/doc-base/dir-test-1', tmp_dir
117
123
    FileUtils.cp 'test/doc-base/dir-test-2', tmp_dir
119
125
    FileUtils.mkdir_p 'test/tmp/share-doc/dir-test-1/manual.html'
120
126
    FileUtils.mkdir_p 'test/tmp/share-doc/dir-test-2/manual.html'
121
127
 
122
 
    tmp_pool = Dhelp::DhelpDocumentPool.new(:doc_base_dir     => [tmp_dir],
123
 
                                            :doc_dir_database => dddb,
124
 
                                            :index_file       => index_file)
 
128
    tmp_pool = Dhelp::DhelpDocumentPool.new(
 
129
                  :doc_base_dir         => [tmp_dir],
 
130
                  :doc_dir_database     => dddb,
 
131
                  :index_file           => index_file,
 
132
                  :indexer_config_file  => config_file
 
133
                  )
125
134
    # 2) Register everything
126
135
    tmp_pool.rebuild
127
136
    # 3) Deregister one of those documents