forked from zdavatz/oddb.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
medreg_doctor.rb
81 lines (78 loc) · 2.45 KB
/
medreg_doctor.rb
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env ruby
# encoding: utf-8
# TestDoctorPlugin -- oddb.org -- 11.05.2012 -- yasaka@ywesee.com
# TestDoctorPlugin -- oddb.org -- 23.03.2011 -- mhatakeyama@ywesee.com
$: << File.expand_path('..', File.dirname(__FILE__))
$: << File.expand_path("../../src", File.dirname(__FILE__))
gem 'minitest'
require 'minitest/autorun'
require 'flexmock'
require 'plugin/medreg_doctor'
require 'tempfile'
class TestDoctorPlugin <Minitest::Test
include FlexMock::TestCase
Test_Personen_XLSX = File.expand_path(File.join(__FILE__, '../../data/xlsx/Personen_20141014.xlsx'))
def setup
@config = flexmock('config')
@app = flexmock('app', :config => @config)
@plugin = ODDB::Doctors::MedregDoctorPlugin.new(@app)
flexmock(@plugin, :get_latest=> Test_Personen_XLSX)
end
def test_update_7601000813282
doctor = flexmock('doctor', :pointer => 'pointer')
flexmock(@app,
:doctor_by_origin => doctor,
:update => 'update'
)
flexmock(@config,
:empty_ids => nil,
:pointer => 'pointer'
)
@plugin = ODDB::Doctors::MedregDoctorPlugin.new(@app, [7601000813282])
flexmock(@plugin, :get_latest=> Test_Personen_XLSX)
flexmock(@plugin, :get_doctor_data => {})
flexmock(@plugin, :puts => nil)
res = @plugin.update
$stdout.puts "res was #{res.inspect}"
assert_equal(1, res)
end
def test_update
doctor = flexmock('doctor', :pointer => 'pointer')
flexmock(@app,
:doctor_by_origin => doctor,
:update => 'update'
)
flexmock(@config,
:empty_ids => nil,
:pointer => 'pointer'
)
flexmock(@plugin, :get_doctor_data => {})
flexmock(@plugin, :puts => nil)
res = @plugin.update
$stdout.puts "res was #{res.inspect}"
assert_equal(27, res)
end if false
def test_store_doctor
skip 'test_store_doctor'
end
def test_delete_doctor
skip 'test_delete_doctor'
end
def test_report
flexmock(@app, :"doctors.size" => 'doctors.size')
expected = "Doctors update \n\nNumber of doctors: doctors.size\nNew doctors: 0\nDeleted doctors: 0\n"
assert_equal(expected, @plugin.report)
end
def test_get_doctor_data
skip "get_doctor_data"
end
def test_fix_doctors
skip "fix_doctor"
end
def test_fix_doctors__runtime_error
skip "fix_doctors__runtime_error"
end
def test_fix_duplicate_eans
skip "fix_duplicate_eans"
end
end