File: apt.rb

package info (click to toggle)
gonzui 1.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,824 kB
  • ctags: 1,448
  • sloc: ruby: 9,570; sh: 5,684; ansic: 1,334; lex: 1,140; makefile: 466; perl: 205; ml: 131
file content (43 lines) | stat: -rwxr-xr-x 1,082 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/env ruby
$LOAD_PATH.unshift("..")
require 'test/unit'
require 'gonzui'
require 'test-util'
include Gonzui

class AptTest < Test::Unit::TestCase
  def _test_apt_get_temporary_directory(aptget)
    assert(File.directory?(aptget.temporary_directory))
    aptget.clean
    assert_equal(false, File.directory?(aptget.temporary_directory))
  end

  def test_apt_get
    return unless AptGet.available?
    apt_type = AptGet.get_apt_type
    assert((apt_type == :rpm or apt_type == :deb))
    config = Config.new
    aptget = AptGet.new(config, "portmap")

    directory = aptget.extract
    assert(File.directory?(directory))

    _test_apt_get_temporary_directory(aptget)
  end

  def test_apt_get_nonexisting
    return unless AptGet.available?
    apt_type = AptGet.get_apt_type
    assert((apt_type == :rpm or apt_type == :deb))
    config = Config.new
    aptget = AptGet.new(config, "qpewrguiniquegnoqwiu")
    begin
      aptget.extract
      assert(false)
    rescue AptGetError => e
      assert(true)
    end

    _test_apt_get_temporary_directory(aptget)
  end
end