Class: ODDB::Swissreg::TestSession

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/swissreg/test/test_session.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



13
14
15
# File 'ext/swissreg/test/test_session.rb', line 13

def setup
  @session = Session.new
end


39
40
41
42
43
44
45
46
47
# File 'ext/swissreg/test/test_session.rb', line 39

def test_extract_result_links
  path = File.expand_path('data/sildenafil.html', 
                          File.dirname(__FILE__))
  html = File.read(path)
  expected = [
    "/srclient/faces/jsp/spc/sr300.jsp?language=de&section=spc&id=C00463756/01",
  ]
  assert_equal(expected, @session.extract_result_links(html))
end

- (Object) test_get_detail__online



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'ext/swissreg/test/test_session.rb', line 23

def test_get_detail__online
  url = "/srclient/faces/jsp/spc/sr300.jsp?language=de&section=spc&id=C00463756/01"
  data = @session.get_detail(url)
  expected = {
    :base_patent       => "EP00463756",
    :base_patent_date    => Date.new(1991, 6, 7),
    :certificate_number  => "C00463756/01",
    :expiry_date       => Date.new(2013, 6, 21),
    :iksnrs              => ["54642"],
    :issue_date          => Date.new(1999, 7, 30),
    :protection_date   => Date.new(2011, 6, 7),
    :publication_date    => Date.new(1998, 8, 31),
    :registration_date => Date.new(1998, 8, 11),
  }
  assert_equal(expected, data)
end

- (Object) test_get_result_list__online



16
17
18
19
20
21
22
# File 'ext/swissreg/test/test_session.rb', line 16

def test_get_result_list__online
  links = @session.get_result_list("sildenafil")
  expected = [
    "/srclient/faces/jsp/spc/sr300.jsp?language=de&section=spc&id=C00463756/01",
  ]
  assert_equal(expected, links)
end