Class: ODDB::MedData::SessionTest

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



16
17
18
# File 'ext/meddata/test/session_test.rb', line 16

def setup
  @session = Session.new()
end

- (Object) test_post_hash__1



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'ext/meddata/test/session_test.rb', line 19

def test_post_hash__1
  data = {
    :name  => 'Meier',
  }
  expected = [
    ['__EVENTTARGET',  ''],
    ['__EVENTARGUMENT', ''],
    ['btnSearch', 'Suche'],
    ['txtSearchName', 'Meier'],
    ['hiddenlang', 'de'],
  ]
  result = @session.post_hash(data)
  assert_equal(expected, result)
end

- (Object) test_post_hash__3



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'ext/meddata/test/session_test.rb', line 48

def test_post_hash__3
  data = {
    :name  => 'Müller',
    :plz =>  '8000',
  }
  expected = [
    ['__EVENTTARGET',  ''],
    ['__EVENTARGUMENT', ''],
    ['btnSearch',  'Suche'],
    ['txtSearchName',  "M\303\274ller"],
    ['txtSearchZIP', "8000"],
    ['hiddenlang', 'de'],
  ]
  result = @session.post_hash(data)
  assert_equal(expected, result)
end

- (Object) test_post_hash__4



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'ext/meddata/test/session_test.rb', line 64

def test_post_hash__4
  data = {
    :name      => 'Müller',
    :plz     =>  '8000',
    :city      => 'Cham',
    :state   => 'Zug',
    :functions =>  'Dienstleistungsfirma',
    :country =>  'Schweiz',
  }
  expected = [
    ['__EVENTTARGET',  ''],
    ['__EVENTARGUMENT', ''],
    ['btnSearch', 'Suche'],
    ['txtSearchName', "M\303\274ller"],
    ['ddlSearchCountry', "Schweiz"],
    ['txtSearchZIP', "8000",],
    ['txtSearchCity', "Cham"],
    ['ddlSearchStates', "Zug"],
    ['ddlSearchFunctions', "Dienstleistungsfirma"],
    ['hiddenlang', 'de'],
  ]
  result = @session.post_hash(data)
  assert_equal(expected, result)
end

- (Object) test_post_hash__utf8



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'ext/meddata/test/session_test.rb', line 33

def test_post_hash__utf8
  # The server expects utf8-encoded data
  data = {
    :name =>  'Müller',
  }
  expected = [
    ['__EVENTTARGET', ''],
    ['__EVENTARGUMENT', ''],
    ['btnSearch', 'Suche'],
    ['txtSearchName', "M\303\274ller"],
    ['hiddenlang', 'de'],
  ]
  result = @session.post_hash(data)
  assert_equal(expected, result)
end