ramaze.ch.oddb.org 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/LICENSE +339 -0
- data/Manifest.txt +285 -0
- data/README.txt +45 -0
- data/Rakefile +28 -0
- data/bin/admin +69 -0
- data/bin/exportd +63 -0
- data/bin/migrate +461 -0
- data/bin/oddbd +62 -0
- data/data/fulltext/data/dicts/french/fulltext.aff +1057 -0
- data/data/fulltext/data/dicts/french/fulltext.dict +91189 -0
- data/data/fulltext/data/dicts/french/fulltext.stop +135 -0
- data/data/fulltext/data/dicts/german/fulltext.aff +1233 -0
- data/data/fulltext/data/dicts/german/fulltext.dict +287574 -0
- data/data/fulltext/data/dicts/german/fulltext.stop +133 -0
- data/data/fulltext/data/german_compound/README +15 -0
- data/data/fulltext/data/german_compound/compound.pl +63 -0
- data/data/fulltext/data/german_compound/german.stop +20 -0
- data/data/fulltext/data/ispell-german-compound.tar.gz +0 -0
- data/data/fulltext/redist/dict_french/Makefile +12 -0
- data/data/fulltext/redist/dict_french/README.french +1 -0
- data/data/fulltext/redist/dict_french/dict_french.sql.in +7 -0
- data/data/fulltext/redist/dict_french/dict_snowball.c +56 -0
- data/data/fulltext/redist/dict_french/french_stem.c +1222 -0
- data/data/fulltext/redist/dict_french/french_stem.h +16 -0
- data/data/fulltext/redist/dict_french/subinclude.h +2 -0
- data/data/fulltext/redist/dict_german/Makefile +12 -0
- data/data/fulltext/redist/dict_german/README.german +1 -0
- data/data/fulltext/redist/dict_german/dict_german.sql.in +7 -0
- data/data/fulltext/redist/dict_german/dict_snowball.c +56 -0
- data/data/fulltext/redist/dict_german/german_stem.c +527 -0
- data/data/fulltext/redist/dict_german/german_stem.h +16 -0
- data/data/fulltext/redist/dict_german/subinclude.h +1 -0
- data/data/fulltext/redist/french_stem.c +1222 -0
- data/data/fulltext/redist/french_stem.h +16 -0
- data/data/fulltext/redist/german_stem.c +527 -0
- data/data/fulltext/redist/german_stem.h +16 -0
- data/lib/fixes/ruby19.rb +21 -0
- data/lib/fixes/selenium.rb +20 -0
- data/lib/fixes/singular.rb +8 -0
- data/lib/fixes/yaml.rb +13 -0
- data/lib/oddb.rb +11 -0
- data/lib/oddb/business/company.rb +18 -0
- data/lib/oddb/business/invoice.rb +75 -0
- data/lib/oddb/business/price.rb +60 -0
- data/lib/oddb/config.rb +73 -0
- data/lib/oddb/drugs.rb +16 -0
- data/lib/oddb/drugs/active_agent.rb +37 -0
- data/lib/oddb/drugs/atc.rb +53 -0
- data/lib/oddb/drugs/composition.rb +41 -0
- data/lib/oddb/drugs/ddd.rb +24 -0
- data/lib/oddb/drugs/dose.rb +107 -0
- data/lib/oddb/drugs/galenic_form.rb +21 -0
- data/lib/oddb/drugs/galenic_group.rb +17 -0
- data/lib/oddb/drugs/package.rb +87 -0
- data/lib/oddb/drugs/part.rb +56 -0
- data/lib/oddb/drugs/product.rb +25 -0
- data/lib/oddb/drugs/sequence.rb +61 -0
- data/lib/oddb/drugs/substance.rb +31 -0
- data/lib/oddb/drugs/substance_group.rb +13 -0
- data/lib/oddb/drugs/unit.rb +12 -0
- data/lib/oddb/export.rb +4 -0
- data/lib/oddb/export/csv.rb +89 -0
- data/lib/oddb/export/l10n_sessions.rb +30 -0
- data/lib/oddb/export/rss.rb +44 -0
- data/lib/oddb/export/server.rb +58 -0
- data/lib/oddb/export/xls.rb +119 -0
- data/lib/oddb/export/yaml.rb +123 -0
- data/lib/oddb/html/state/drugs/admin/package.rb +189 -0
- data/lib/oddb/html/state/drugs/admin/product.rb +56 -0
- data/lib/oddb/html/state/drugs/admin/sequence.rb +259 -0
- data/lib/oddb/html/state/drugs/ajax/explain_ddd_price.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/explain_price.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/global.rb +18 -0
- data/lib/oddb/html/state/drugs/ajax/package_infos.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/remote_infos.rb +19 -0
- data/lib/oddb/html/state/drugs/atc_browser.rb +39 -0
- data/lib/oddb/html/state/drugs/atc_guidelines.rb +21 -0
- data/lib/oddb/html/state/drugs/compare.rb +52 -0
- data/lib/oddb/html/state/drugs/download_export.rb +18 -0
- data/lib/oddb/html/state/drugs/fachinfo.rb +21 -0
- data/lib/oddb/html/state/drugs/feedback.rb +94 -0
- data/lib/oddb/html/state/drugs/global.rb +266 -0
- data/lib/oddb/html/state/drugs/init.rb +18 -0
- data/lib/oddb/html/state/drugs/login.rb +17 -0
- data/lib/oddb/html/state/drugs/package.rb +32 -0
- data/lib/oddb/html/state/drugs/patinfo.rb +21 -0
- data/lib/oddb/html/state/drugs/products.rb +51 -0
- data/lib/oddb/html/state/drugs/result.rb +125 -0
- data/lib/oddb/html/state/global.rb +165 -0
- data/lib/oddb/html/state/global_predefine.rb +17 -0
- data/lib/oddb/html/state/limit.rb +17 -0
- data/lib/oddb/html/state/login.rb +56 -0
- data/lib/oddb/html/state/paypal/checkout.rb +130 -0
- data/lib/oddb/html/state/paypal/collect.rb +46 -0
- data/lib/oddb/html/state/paypal/redirect.rb +18 -0
- data/lib/oddb/html/state/register_export.rb +38 -0
- data/lib/oddb/html/state/register_poweruser.rb +17 -0
- data/lib/oddb/html/state/viral/admin.rb +76 -0
- data/lib/oddb/html/state/viral/poweruser.rb +16 -0
- data/lib/oddb/html/util/annotated_list.rb +39 -0
- data/lib/oddb/html/util/know_it_all.rb +28 -0
- data/lib/oddb/html/util/known_user.rb +55 -0
- data/lib/oddb/html/util/lookandfeel.rb +554 -0
- data/lib/oddb/html/util/need_all_input.rb +29 -0
- data/lib/oddb/html/util/session.rb +88 -0
- data/lib/oddb/html/util/sort.rb +72 -0
- data/lib/oddb/html/util/unsaved_helper.rb +20 -0
- data/lib/oddb/html/util/validator.rb +54 -0
- data/lib/oddb/html/view/ajax/json.rb +22 -0
- data/lib/oddb/html/view/alpha_header.rb +28 -0
- data/lib/oddb/html/view/document.rb +126 -0
- data/lib/oddb/html/view/drugs/admin/package.rb +237 -0
- data/lib/oddb/html/view/drugs/admin/product.rb +104 -0
- data/lib/oddb/html/view/drugs/admin/sequence.rb +312 -0
- data/lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb +87 -0
- data/lib/oddb/html/view/drugs/ajax/explain_price.rb +61 -0
- data/lib/oddb/html/view/drugs/ajax/package_infos.rb +105 -0
- data/lib/oddb/html/view/drugs/ajax/remote_infos.rb +44 -0
- data/lib/oddb/html/view/drugs/atc_browser.rb +68 -0
- data/lib/oddb/html/view/drugs/atc_guidelines.rb +94 -0
- data/lib/oddb/html/view/drugs/compare.rb +95 -0
- data/lib/oddb/html/view/drugs/download_export.rb +28 -0
- data/lib/oddb/html/view/drugs/fachinfo.rb +46 -0
- data/lib/oddb/html/view/drugs/feedback.rb +231 -0
- data/lib/oddb/html/view/drugs/init.rb +51 -0
- data/lib/oddb/html/view/drugs/legend.rb +24 -0
- data/lib/oddb/html/view/drugs/package.rb +398 -0
- data/lib/oddb/html/view/drugs/patinfo.rb +46 -0
- data/lib/oddb/html/view/drugs/products.rb +97 -0
- data/lib/oddb/html/view/drugs/result.rb +296 -0
- data/lib/oddb/html/view/drugs/search.rb +33 -0
- data/lib/oddb/html/view/drugs/template.rb +15 -0
- data/lib/oddb/html/view/foot.rb +52 -0
- data/lib/oddb/html/view/google.rb +23 -0
- data/lib/oddb/html/view/google_ads.rb +40 -0
- data/lib/oddb/html/view/head.rb +78 -0
- data/lib/oddb/html/view/limit.rb +109 -0
- data/lib/oddb/html/view/list.rb +59 -0
- data/lib/oddb/html/view/login.rb +38 -0
- data/lib/oddb/html/view/navigation.rb +67 -0
- data/lib/oddb/html/view/offset_header.rb +35 -0
- data/lib/oddb/html/view/paypal/collect.rb +84 -0
- data/lib/oddb/html/view/paypal/redirect.rb +51 -0
- data/lib/oddb/html/view/paypal/register_form.rb +106 -0
- data/lib/oddb/html/view/register_export.rb +29 -0
- data/lib/oddb/html/view/register_poweruser.rb +29 -0
- data/lib/oddb/html/view/rss/feedback.rb +64 -0
- data/lib/oddb/html/view/rss_preview.rb +54 -0
- data/lib/oddb/html/view/search.rb +104 -0
- data/lib/oddb/html/view/snapback.rb +24 -0
- data/lib/oddb/html/view/template.rb +56 -0
- data/lib/oddb/import/excel.rb +45 -0
- data/lib/oddb/import/import.rb +39 -0
- data/lib/oddb/import/rtf.rb +410 -0
- data/lib/oddb/import/whocc.rb +173 -0
- data/lib/oddb/import/xml.rb +15 -0
- data/lib/oddb/model.rb +179 -0
- data/lib/oddb/persistence/odba.rb +33 -0
- data/lib/oddb/persistence/odba/business/company.rb +13 -0
- data/lib/oddb/persistence/odba/business/invoice.rb +15 -0
- data/lib/oddb/persistence/odba/drugs/atc.rb +15 -0
- data/lib/oddb/persistence/odba/drugs/galenic_form.rb +18 -0
- data/lib/oddb/persistence/odba/drugs/galenic_group.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/package.rb +25 -0
- data/lib/oddb/persistence/odba/drugs/product.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/sequence.rb +21 -0
- data/lib/oddb/persistence/odba/drugs/substance.rb +21 -0
- data/lib/oddb/persistence/odba/drugs/substance_group.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/unit.rb +13 -0
- data/lib/oddb/persistence/odba/export.rb +26 -0
- data/lib/oddb/persistence/odba/model.rb +68 -0
- data/lib/oddb/persistence/odba/regulatory/authority.rb +13 -0
- data/lib/oddb/persistence/odba/regulatory/registration.rb +13 -0
- data/lib/oddb/persistence/odba/text/document.rb +11 -0
- data/lib/oddb/persistence/odba/util/code.rb +11 -0
- data/lib/oddb/persistence/odba/util/m10l_document.rb +13 -0
- data/lib/oddb/persistence/og.rb +16 -0
- data/lib/oddb/persistence/og/drugs/composition.rb +14 -0
- data/lib/oddb/persistence/og/drugs/product.rb +14 -0
- data/lib/oddb/persistence/og/drugs/sequence.rb +15 -0
- data/lib/oddb/persistence/og/model.rb +25 -0
- data/lib/oddb/persistence/og/util/multilingual.rb +13 -0
- data/lib/oddb/redist/rtf_tools/reader.rb +139 -0
- data/lib/oddb/regulatory/authority.rb +14 -0
- data/lib/oddb/regulatory/registration.rb +15 -0
- data/lib/oddb/remote/business/company.rb +23 -0
- data/lib/oddb/remote/drugs/active_agent.rb +27 -0
- data/lib/oddb/remote/drugs/atc.rb +32 -0
- data/lib/oddb/remote/drugs/dose.rb +8 -0
- data/lib/oddb/remote/drugs/galenic_form.rb +25 -0
- data/lib/oddb/remote/drugs/package.rb +126 -0
- data/lib/oddb/remote/drugs/part.rb +30 -0
- data/lib/oddb/remote/drugs/product.rb +19 -0
- data/lib/oddb/remote/drugs/sequence.rb +46 -0
- data/lib/oddb/remote/drugs/substance.rb +20 -0
- data/lib/oddb/remote/drugs/unit.rb +19 -0
- data/lib/oddb/remote/object.rb +36 -0
- data/lib/oddb/remote/text/document.rb +20 -0
- data/lib/oddb/remote/util/m10l_document.rb +22 -0
- data/lib/oddb/text/chapter.rb +27 -0
- data/lib/oddb/text/document.rb +43 -0
- data/lib/oddb/text/format.rb +37 -0
- data/lib/oddb/text/paragraph.rb +58 -0
- data/lib/oddb/text/picture.rb +93 -0
- data/lib/oddb/text/table.rb +68 -0
- data/lib/oddb/util.rb +8 -0
- data/lib/oddb/util/annotated_list.rb +37 -0
- data/lib/oddb/util/code.rb +69 -0
- data/lib/oddb/util/comparison.rb +36 -0
- data/lib/oddb/util/exporter.rb +8 -0
- data/lib/oddb/util/feedback.rb +23 -0
- data/lib/oddb/util/ipn.rb +48 -0
- data/lib/oddb/util/m10l_document.rb +38 -0
- data/lib/oddb/util/mail.rb +73 -0
- data/lib/oddb/util/money.rb +60 -0
- data/lib/oddb/util/multilingual.rb +70 -0
- data/lib/oddb/util/quanty.rb +4 -0
- data/lib/oddb/util/quanty/fact.rb +229 -0
- data/lib/oddb/util/quanty/main.rb +160 -0
- data/lib/oddb/util/quanty/parse.rb +853 -0
- data/lib/oddb/util/quanty/units.dump +0 -0
- data/lib/oddb/util/server.rb +117 -0
- data/lib/oddb/util/updater.rb +41 -0
- data/lib/oddb/util/ydim.rb +110 -0
- data/lib/oddb/util/yus.rb +46 -0
- data/test/business/test_company.rb +29 -0
- data/test/business/test_price.rb +46 -0
- data/test/drugs/test_active_agent.rb +53 -0
- data/test/drugs/test_atc.rb +54 -0
- data/test/drugs/test_composition.rb +88 -0
- data/test/drugs/test_ddd.rb +22 -0
- data/test/drugs/test_dose.rb +190 -0
- data/test/drugs/test_galenic_form.rb +41 -0
- data/test/drugs/test_package.rb +173 -0
- data/test/drugs/test_part.rb +32 -0
- data/test/drugs/test_product.rb +31 -0
- data/test/drugs/test_sequence.rb +140 -0
- data/test/drugs/test_substance.rb +51 -0
- data/test/drugs/test_substance_group.rb +27 -0
- data/test/export/test_rss.rb +94 -0
- data/test/export/test_server.rb +117 -0
- data/test/export/test_xls.rb +152 -0
- data/test/export/test_yaml.rb +120 -0
- data/test/import/data/html/whocc/A.html +56 -0
- data/test/import/data/html/whocc/A03.html +48 -0
- data/test/import/data/html/whocc/A03AB.html +48 -0
- data/test/import/data/html/whocc/A06AA.html +47 -0
- data/test/import/data/html/whocc/C03.html +47 -0
- data/test/import/data/html/whocc/login.html +77 -0
- data/test/import/data/xml/ATC_2006.xml +47 -0
- data/test/import/data/xml/ATC_2006_ddd.xml +35 -0
- data/test/import/test_excel.rb +34 -0
- data/test/import/test_rtf.rb +40 -0
- data/test/import/test_whocc.rb +315 -0
- data/test/remote/drugs/test_active_agent.rb +36 -0
- data/test/selenium/selenium-server.jar +0 -0
- data/test/selenium/test_atc_browser.rb +122 -0
- data/test/selenium/test_atc_guidelines.rb +96 -0
- data/test/selenium/test_collect.rb +138 -0
- data/test/selenium/test_compare.rb +206 -0
- data/test/selenium/test_fachinfo.rb +130 -0
- data/test/selenium/test_feedback.rb +196 -0
- data/test/selenium/test_init.rb +52 -0
- data/test/selenium/test_limit.rb +305 -0
- data/test/selenium/test_login.rb +67 -0
- data/test/selenium/test_package.rb +512 -0
- data/test/selenium/test_patinfo.rb +131 -0
- data/test/selenium/test_product.rb +80 -0
- data/test/selenium/test_products.rb +142 -0
- data/test/selenium/test_search.rb +715 -0
- data/test/selenium/test_sequence.rb +543 -0
- data/test/selenium/unit.rb +185 -0
- data/test/stub/http_server.rb +169 -0
- data/test/stub/model.rb +173 -0
- data/test/suite.rb +15 -0
- data/test/test_model.rb +83 -0
- data/test/util/test_code.rb +74 -0
- data/test/util/test_ipn.rb +117 -0
- data/test/util/test_mail.rb +86 -0
- data/test/util/test_multilingual.rb +97 -0
- data/test/util/test_server.rb +48 -0
- data/test/util/test_updater.rb +353 -0
- data/test/util/test_ydim.rb +115 -0
- data/test/util/test_yus.rb +79 -0
- metadata +418 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Remote::Drugs::TestActiveAgent -- de.oddb.org -- 20.02.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
$: << File.expand_path('../../../lib', File.dirname(__FILE__))
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require 'oddb/drugs/active_agent'
|
8
|
+
require 'oddb/drugs/substance'
|
9
|
+
require 'oddb/remote/drugs/active_agent'
|
10
|
+
require 'flexmock'
|
11
|
+
|
12
|
+
module ODDB
|
13
|
+
module Remote
|
14
|
+
module Drugs
|
15
|
+
class TestActiveAgent < Test::Unit::TestCase
|
16
|
+
include FlexMock::TestCase
|
17
|
+
def setup
|
18
|
+
@remote = flexmock('Remote')
|
19
|
+
rsub = flexmock('Substance')
|
20
|
+
rsub.should_receive(:de).and_return('Substance')
|
21
|
+
@remote.should_receive(:substance).and_return(rsub)
|
22
|
+
@active_agent = ActiveAgent.new(0, @remote)
|
23
|
+
end
|
24
|
+
def test_spaceship__no_dose
|
25
|
+
sub = ODDB::Drugs::Substance.new
|
26
|
+
sub.name.de = 'Substance'
|
27
|
+
local = ODDB::Drugs::ActiveAgent.new(sub, 10)
|
28
|
+
@remote.should_receive(:dose).and_return(nil)
|
29
|
+
assert_nothing_raised {
|
30
|
+
@active_agent <=> local
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
Binary file
|
@@ -0,0 +1,122 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# Selenium::TestAtcBrowser -- de.oddb.org -- 14.12.2007 -- hwyss@ywesee.com
|
4
|
+
|
5
|
+
$: << File.expand_path('..', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'selenium/unit'
|
8
|
+
require 'stub/model'
|
9
|
+
|
10
|
+
module ODDB
|
11
|
+
module Selenium
|
12
|
+
class TestAtcBrowser < Test::Unit::TestCase
|
13
|
+
include Selenium::TestCase
|
14
|
+
def setup
|
15
|
+
super
|
16
|
+
atc1 = Drugs::Atc.new('N04BA02')
|
17
|
+
atc1.name.de = 'Levodopa und Decarboxylasehemmer'
|
18
|
+
ddd = Drugs::Ddd.new('O')
|
19
|
+
ddd.dose = Drugs::Dose.new(0.6, 'g')
|
20
|
+
atc1.add_ddd(ddd)
|
21
|
+
atc1.save
|
22
|
+
atc2 = Drugs::Atc.new('N04BA')
|
23
|
+
atc2.name.de = 'Dopa und Dopa-Derivate'
|
24
|
+
atc2.guidelines.en = <<-EOS
|
25
|
+
Combinations with decarboxylase inhibitors and other dopaminergic agents are classified here.
|
26
|
+
EOS
|
27
|
+
atc2.ddd_guidelines.en = <<-EOS
|
28
|
+
The DDD for the combination of levodopa and decarboxylase inhibitor is based on the content of levodopa, see ATC index.
|
29
|
+
EOS
|
30
|
+
atc2.save
|
31
|
+
atc3 = Drugs::Atc.new('N04B')
|
32
|
+
atc3.name.de = 'Dopaminerge Mittel'
|
33
|
+
atc3.save
|
34
|
+
atc4 = Drugs::Atc.new('N04')
|
35
|
+
atc4.name.de = 'Antiparkinsonmittel'
|
36
|
+
atc4.guidelines.en = <<-EOS
|
37
|
+
This group comprises preparations used in the treatment of Parkinson's disease and related conditions, including drug-induced parkinsonism.
|
38
|
+
EOS
|
39
|
+
atc4.ddd_guidelines.en = <<-EOS
|
40
|
+
The DDDs are based on recommended doses for the long-term treatment of symptoms of Parkinson's disease.
|
41
|
+
No separate DDDs are established for oral depot formulations.
|
42
|
+
EOS
|
43
|
+
atc4.save
|
44
|
+
atc5 = Drugs::Atc.new('N')
|
45
|
+
atc5.name.de = 'Nervensystem'
|
46
|
+
atc5.save
|
47
|
+
atc6 = Drugs::Atc.new('N04BA03')
|
48
|
+
atc6.name.de = 'Levodopa, Decarboxylasehemmer und COMT-Hemmer'
|
49
|
+
atc6.save
|
50
|
+
flexstub(atc6).should_receive(:packages).and_return(['nonempty'])
|
51
|
+
end
|
52
|
+
def test_atc_browser
|
53
|
+
open "/de/drugs/atc_browser"
|
54
|
+
|
55
|
+
assert_equal 'CH - ODDB.org | Medikamente | ATC-Browser | Open Drug Database',
|
56
|
+
get_title
|
57
|
+
|
58
|
+
assert is_text_present('Nervensystem (N)')
|
59
|
+
assert is_element_present('link=Nervensystem (N)')
|
60
|
+
assert !is_text_present('Antiparkinsonmittel (N04)')
|
61
|
+
assert !is_element_present('link=ddd')
|
62
|
+
|
63
|
+
click 'link=Nervensystem (N)'
|
64
|
+
wait_for_page_to_load 30
|
65
|
+
|
66
|
+
assert_equal 'CH - ODDB.org | Medikamente | ATC-Browser | Open Drug Database',
|
67
|
+
get_title
|
68
|
+
assert is_text_present('Nervensystem (N)')
|
69
|
+
assert is_element_present('link=Nervensystem (N)')
|
70
|
+
assert is_text_present('Antiparkinsonmittel (N04)')
|
71
|
+
assert is_element_present('link=Antiparkinsonmittel (N04)')
|
72
|
+
assert is_element_present('link=WHO-DDD')
|
73
|
+
## opened because they are single children:
|
74
|
+
assert is_text_present("Dopaminerge Mittel (N04B)")
|
75
|
+
assert is_element_present("link=Dopaminerge Mittel (N04B)")
|
76
|
+
assert is_text_present("Dopa und Dopa-Derivate (N04BA)")
|
77
|
+
assert is_element_present("link=Dopa und Dopa-Derivate (N04BA)")
|
78
|
+
assert is_text_present("Levodopa und Decarboxylasehemmer (N04BA02)")
|
79
|
+
assert is_text_present("Levodopa, Decarboxylasehemmer und COMT-Hemmer (N04BA03)")
|
80
|
+
## has no packages
|
81
|
+
assert !is_element_present("link=Levodopa und Decarboxylasehemmer (N04BA02)")
|
82
|
+
## has packages
|
83
|
+
assert is_element_present("link=Levodopa, Decarboxylasehemmer und COMT-Hemmer (N04BA03)")
|
84
|
+
|
85
|
+
|
86
|
+
click 'link=Antiparkinsonmittel (N04)'
|
87
|
+
wait_for_page_to_load 30
|
88
|
+
assert_equal 'CH - ODDB.org | Medikamente | ATC-Browser | Open Drug Database',
|
89
|
+
get_title
|
90
|
+
assert is_text_present('Nervensystem (N)')
|
91
|
+
assert is_element_present('link=Nervensystem (N)')
|
92
|
+
assert is_text_present('Antiparkinsonmittel (N04)')
|
93
|
+
assert !is_element_present('link=Antiparkinsonmittel (N04)')
|
94
|
+
assert is_element_present('link=WHO-DDD')
|
95
|
+
## opened because they are single children:
|
96
|
+
assert is_text_present("Dopaminerge Mittel (N04B)")
|
97
|
+
assert is_element_present("link=Dopaminerge Mittel (N04B)")
|
98
|
+
assert is_text_present("Dopa und Dopa-Derivate (N04BA)")
|
99
|
+
assert is_element_present("link=Dopa und Dopa-Derivate (N04BA)")
|
100
|
+
assert is_text_present("Levodopa und Decarboxylasehemmer (N04BA02)")
|
101
|
+
assert is_text_present("Levodopa, Decarboxylasehemmer und COMT-Hemmer (N04BA03)")
|
102
|
+
## has no packages
|
103
|
+
assert !is_element_present("link=Levodopa und Decarboxylasehemmer (N04BA02)")
|
104
|
+
## has packages
|
105
|
+
assert is_element_present("link=Levodopa, Decarboxylasehemmer und COMT-Hemmer (N04BA03)")
|
106
|
+
|
107
|
+
end
|
108
|
+
def test_atc_browser__limited
|
109
|
+
ODDB.config.query_limit = 1
|
110
|
+
open "/de/drugs/atc_browser"
|
111
|
+
assert_equal 'CH - ODDB.org | Medikamente | ATC-Browser | Open Drug Database',
|
112
|
+
get_title
|
113
|
+
open "/de/drugs/atc_browser"
|
114
|
+
assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
|
115
|
+
get_title
|
116
|
+
assert is_text_present("Abfragebeschränkung")
|
117
|
+
ensure
|
118
|
+
ODDB.config.query_limit = 20
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# Selenium::TestAtcGuidelines -- de.oddb.org -- 16.03.2007 -- hwyss@ywesee.com
|
4
|
+
|
5
|
+
$: << File.expand_path('..', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'selenium/unit'
|
8
|
+
require 'stub/model'
|
9
|
+
|
10
|
+
module ODDB
|
11
|
+
module Selenium
|
12
|
+
class TestAtcGuidelines < Test::Unit::TestCase
|
13
|
+
include Selenium::TestCase
|
14
|
+
def setup
|
15
|
+
super
|
16
|
+
@atc1 = Drugs::Atc.new('N04BA02')
|
17
|
+
@atc1.name.de = 'Levodopa und Decarboxylasehemmer'
|
18
|
+
ddd = Drugs::Ddd.new('O')
|
19
|
+
ddd.dose = Drugs::Dose.new(0.6, 'g')
|
20
|
+
@atc1.add_ddd(ddd)
|
21
|
+
@atc1.save
|
22
|
+
@atc2 = Drugs::Atc.new('N04BA')
|
23
|
+
@atc2.name.de = 'Dopa und Dopa-Derivate'
|
24
|
+
@atc2.guidelines.en = <<-EOS
|
25
|
+
Combinations with decarboxylase inhibitors and other dopaminergic agents are classified here.
|
26
|
+
EOS
|
27
|
+
@atc2.ddd_guidelines.en = <<-EOS
|
28
|
+
The DDD for the combination of levodopa and decarboxylase inhibitor is based on the content of levodopa, see ATC index.
|
29
|
+
EOS
|
30
|
+
@atc2.save
|
31
|
+
@atc3 = Drugs::Atc.new('N04B')
|
32
|
+
@atc3.name.de = 'Dopaminerge Mittel'
|
33
|
+
@atc3.save
|
34
|
+
@atc4 = Drugs::Atc.new('N04')
|
35
|
+
@atc4.name.de = 'Antiparkinsonmittel'
|
36
|
+
@atc4.guidelines.en = <<-EOS
|
37
|
+
This group comprises preparations used in the treatment of Parkinson's disease and related conditions, including drug-induced parkinsonism.
|
38
|
+
EOS
|
39
|
+
@atc4.ddd_guidelines.en = <<-EOS
|
40
|
+
The DDDs are based on recommended doses for the long-term treatment of symptoms of Parkinson's disease.
|
41
|
+
No separate DDDs are established for oral depot formulations.
|
42
|
+
EOS
|
43
|
+
@atc4.save
|
44
|
+
@atc5 = Drugs::Atc.new('N')
|
45
|
+
@atc5.name.de = 'Nervensystem'
|
46
|
+
@atc5.save
|
47
|
+
@atc6 = Drugs::Atc.new('N04BA03')
|
48
|
+
@atc6.name.de = 'Levodopa, Decarboxylasehemmer und COMT-Hemmer'
|
49
|
+
@atc6.save
|
50
|
+
end
|
51
|
+
def test_guidelines
|
52
|
+
open "/de/drugs/ddd/code/N04BA02"
|
53
|
+
|
54
|
+
assert_equal 'CH - ODDB.org | Medikamente | Tagesdosis | N04BA02 | Open Drug Database',
|
55
|
+
get_title
|
56
|
+
assert is_text_present('N - Nervensystem')
|
57
|
+
assert is_text_present('N04 - Antiparkinsonmittel')
|
58
|
+
assert is_text_present(@atc4.guidelines.en)
|
59
|
+
assert is_text_present(@atc4.ddd_guidelines.en)
|
60
|
+
assert is_text_present('N04B - Dopaminerge Mittel')
|
61
|
+
assert is_text_present('N04BA - Dopa und Dopa-Derivate')
|
62
|
+
assert is_text_present(@atc2.guidelines.en)
|
63
|
+
assert is_text_present(@atc2.ddd_guidelines.en)
|
64
|
+
assert is_text_present('N04BA02 - Levodopa und Decarboxylasehemmer')
|
65
|
+
assert is_text_present('Oral')
|
66
|
+
|
67
|
+
click 'link=N04BA'
|
68
|
+
wait_for_page_to_load 30
|
69
|
+
assert_equal 'CH - ODDB.org | Medikamente | Tagesdosis | N04BA | Open Drug Database',
|
70
|
+
get_title
|
71
|
+
assert is_text_present('N - Nervensystem')
|
72
|
+
assert is_text_present('N04 - Antiparkinsonmittel')
|
73
|
+
assert is_text_present(@atc4.guidelines.en)
|
74
|
+
assert is_text_present(@atc4.ddd_guidelines.en)
|
75
|
+
assert is_text_present('N04B - Dopaminerge Mittel')
|
76
|
+
assert is_text_present('N04BA - Dopa und Dopa-Derivate')
|
77
|
+
assert is_text_present(@atc2.guidelines.en)
|
78
|
+
assert is_text_present(@atc2.ddd_guidelines.en)
|
79
|
+
assert !is_text_present('N04BA02 - Levodopa und Decarboxylasehemmer')
|
80
|
+
assert !is_text_present('Oral')
|
81
|
+
end
|
82
|
+
def test_guidelines__limited
|
83
|
+
ODDB.config.query_limit = 1
|
84
|
+
open "/de/drugs/ddd/code/N04BA02"
|
85
|
+
assert_equal 'CH - ODDB.org | Medikamente | Tagesdosis | N04BA02 | Open Drug Database',
|
86
|
+
get_title
|
87
|
+
open "/de/drugs/ddd/code/N04BA02"
|
88
|
+
assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
|
89
|
+
get_title
|
90
|
+
assert is_text_present("Abfragebeschränkung")
|
91
|
+
ensure
|
92
|
+
ODDB.config.query_limit = 20
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# Selenium::Collect -- de.oddb.org -- 04.02.2008 -- hwyss@ywesee.com
|
4
|
+
|
5
|
+
$: << File.expand_path('..', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'selenium/unit'
|
8
|
+
require 'stub/model'
|
9
|
+
|
10
|
+
module ODDB
|
11
|
+
module Selenium
|
12
|
+
class TestCollect < Test::Unit::TestCase
|
13
|
+
include Selenium::TestCase
|
14
|
+
def test_collect__unknown_invoice
|
15
|
+
open "/de/drugs/collect/invoice/875967c31e83eec9decea52130e7ee72"
|
16
|
+
assert is_text_present('Fehler')
|
17
|
+
assert is_text_present('Ihre Transaktion ist bei uns nicht registriert. Setzen Sie sich bitte per E-Mail mit uns in Verbindung.')
|
18
|
+
end
|
19
|
+
def test_collect__unpaid_invoice
|
20
|
+
email = 'test@invoice.ch'
|
21
|
+
invoice = Business::Invoice.new
|
22
|
+
invoice.yus_name = email
|
23
|
+
item = invoice.add :poweruser, "unlimited access", 365, "Tage", 2
|
24
|
+
invoice.save
|
25
|
+
id = invoice.id
|
26
|
+
|
27
|
+
open "/de/drugs/collect/invoice/#{id}"
|
28
|
+
assert is_text_present('Ihre Bezahlung ist von PayPal noch nicht bestätigt worden. Sobald dies geschieht werden wir Sie per E-Mail benachrichtigen.')
|
29
|
+
## automatic reload
|
30
|
+
wait_for_page_to_load 30
|
31
|
+
assert is_text_present('Ihre Bezahlung ist von PayPal noch nicht bestätigt worden. Sobald dies geschieht werden wir Sie per E-Mail benachrichtigen.')
|
32
|
+
end
|
33
|
+
def test_collect
|
34
|
+
email = 'test@invoice.ch'
|
35
|
+
invoice = Business::Invoice.new
|
36
|
+
invoice.yus_name = email
|
37
|
+
item = invoice.add :poweruser, "unlimited access", 365, "Tage", 2
|
38
|
+
invoice.status = 'completed'
|
39
|
+
invoice.save
|
40
|
+
id = invoice.id
|
41
|
+
|
42
|
+
open "/de/drugs/collect/invoice/#{id}"
|
43
|
+
assert is_text_present('Vielen Dank! Als angemeldeter Benutzer können Sie jetzt ohne Beschränkung Abfragen vornehmen.')
|
44
|
+
assert is_text_present('Ihr PowerUser-Account ist bereit. Bitte melden Sie sich hier erneut mit E-Mail und Passwort an.')
|
45
|
+
|
46
|
+
click 'link=hier'
|
47
|
+
wait_for_page_to_load 30
|
48
|
+
assert is_element_present("email")
|
49
|
+
assert is_element_present("pass")
|
50
|
+
end
|
51
|
+
def test_collect__logged_in
|
52
|
+
ODDB.config.auth_domain = 'org.oddb.de'
|
53
|
+
|
54
|
+
email = 'test@invoice.ch'
|
55
|
+
invoice = Business::Invoice.new
|
56
|
+
invoice.yus_name = email
|
57
|
+
item = invoice.add :poweruser, "unlimited access", 365, "Tage", 2
|
58
|
+
invoice.status = 'completed'
|
59
|
+
invoice.save
|
60
|
+
id = invoice.id
|
61
|
+
|
62
|
+
permissions = [
|
63
|
+
['login', 'org.oddb.de.PowerUser'], ['view', 'org.oddb.de']
|
64
|
+
]
|
65
|
+
login email, *permissions
|
66
|
+
|
67
|
+
open "/de/drugs/collect/invoice/#{id}"
|
68
|
+
assert is_text_present('Vielen Dank! Als angemeldeter Benutzer können Sie jetzt ohne Beschränkung Abfragen vornehmen.')
|
69
|
+
assert is_text_present('Sie sind bereits angemeldet und können sofort weitersuchen.')
|
70
|
+
end
|
71
|
+
def test_collect__redirect
|
72
|
+
ODDB.config.auth_domain = 'org.oddb.de'
|
73
|
+
ODDB.config.query_limit = 1
|
74
|
+
package = setup_package
|
75
|
+
open "/de/drugs/search/query/Amantadin"
|
76
|
+
assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
|
77
|
+
get_title
|
78
|
+
open "/de/drugs/search/query/Amantadin"
|
79
|
+
assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
|
80
|
+
get_title
|
81
|
+
assert is_text_present("Abfragebeschränkung")
|
82
|
+
|
83
|
+
email = 'test@invoice.ch'
|
84
|
+
invoice = Business::Invoice.new
|
85
|
+
invoice.yus_name = email
|
86
|
+
item = invoice.add :poweruser, "unlimited access", 365, "Tage", 2
|
87
|
+
invoice.status = 'completed'
|
88
|
+
invoice.save
|
89
|
+
id = invoice.id
|
90
|
+
|
91
|
+
permissions = [
|
92
|
+
['login', 'org.oddb.de.PowerUser'], ['view', 'org.oddb.de']
|
93
|
+
]
|
94
|
+
login email, *permissions
|
95
|
+
|
96
|
+
open "/de/drugs/collect/invoice/#{id}"
|
97
|
+
assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
|
98
|
+
get_title
|
99
|
+
ensure
|
100
|
+
ODDB.config.query_limit = 20
|
101
|
+
end
|
102
|
+
def test_collect__redirect__later
|
103
|
+
ODDB.config.auth_domain = 'org.oddb.de'
|
104
|
+
ODDB.config.query_limit = 1
|
105
|
+
package = setup_package
|
106
|
+
open "/de/drugs/search/query/Amantadin"
|
107
|
+
assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
|
108
|
+
get_title
|
109
|
+
open "/de/drugs/search/query/Amantadin"
|
110
|
+
assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
|
111
|
+
get_title
|
112
|
+
assert is_text_present("Abfragebeschränkung")
|
113
|
+
|
114
|
+
email = 'test@invoice.ch'
|
115
|
+
invoice = Business::Invoice.new
|
116
|
+
invoice.yus_name = email
|
117
|
+
item = invoice.add :poweruser, "unlimited access", 365, "Tage", 2
|
118
|
+
invoice.save
|
119
|
+
id = invoice.id
|
120
|
+
|
121
|
+
user = login email, ['login', 'org.oddb.de.PowerUser']
|
122
|
+
|
123
|
+
open "/de/drugs/collect/invoice/#{id}"
|
124
|
+
assert is_text_present('Ihre Bezahlung ist von PayPal noch nicht bestätigt worden. Sobald dies geschieht werden wir Sie per E-Mail benachrichtigen.')
|
125
|
+
|
126
|
+
invoice.status = 'completed'
|
127
|
+
user.permissions.push ['view', 'org.oddb.de']
|
128
|
+
|
129
|
+
## automatic reload
|
130
|
+
wait_for_page_to_load 30
|
131
|
+
assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
|
132
|
+
get_title
|
133
|
+
ensure
|
134
|
+
ODDB.config.query_limit = 20
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# Selenium::TestCompare -- de.oddb.org -- 15.02.2007 -- hwyss@ywesee.com
|
4
|
+
|
5
|
+
$: << File.expand_path('..', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'selenium/unit'
|
8
|
+
require 'stub/model'
|
9
|
+
require 'oddb/drugs'
|
10
|
+
require 'oddb/util'
|
11
|
+
require 'odba/drbwrapper'
|
12
|
+
require 'odba'
|
13
|
+
|
14
|
+
module ODDB
|
15
|
+
module Selenium
|
16
|
+
class TestCompare < Test::Unit::TestCase
|
17
|
+
include Selenium::TestCase
|
18
|
+
def setup
|
19
|
+
@cache = flexstub(ODBA.cache)
|
20
|
+
flexstub(Currency).should_receive(:rate)\
|
21
|
+
.with('EUR', 'CHF').and_return(1.5)
|
22
|
+
flexstub(Currency).should_receive(:rate)\
|
23
|
+
.with('EUR', 'CHF').and_return(1.5)
|
24
|
+
currency = flexmock('Currency')
|
25
|
+
@currency = DRb.start_service('druby://localhost:0', currency)
|
26
|
+
ODDB.config.currency_rates = @currency.uri
|
27
|
+
currency.should_receive(:rate).with('EUR', 'CHF').and_return(1.6)
|
28
|
+
super
|
29
|
+
end
|
30
|
+
def setup_package(name, pzn='12345', price=6)
|
31
|
+
product = Drugs::Product.new
|
32
|
+
company = Business::Company.new
|
33
|
+
company.name.de = 'Producer AG'
|
34
|
+
product.company = company
|
35
|
+
company.save
|
36
|
+
sequence = Drugs::Sequence.new
|
37
|
+
atc = Drugs::Atc.new('N04BB01')
|
38
|
+
atc.name.de = 'Amantadin'
|
39
|
+
sequence.atc = atc
|
40
|
+
atc.save
|
41
|
+
sequence.product = product
|
42
|
+
composition = Drugs::Composition.new
|
43
|
+
sequence.add_composition(composition)
|
44
|
+
substance = Drugs::Substance.new
|
45
|
+
substance.name.de = 'Amantadin'
|
46
|
+
dose = Drugs::Dose.new(100, 'mg')
|
47
|
+
active_agent = Drugs::ActiveAgent.new(substance, dose)
|
48
|
+
composition.add_active_agent(active_agent)
|
49
|
+
galform = Drugs::GalenicForm.new
|
50
|
+
galform.description.de = 'Tropfen'
|
51
|
+
galform.group = Drugs::GalenicGroup.new('Tropfen')
|
52
|
+
composition.galenic_form = galform
|
53
|
+
package = Drugs::Package.new
|
54
|
+
code = Util::Code.new(:festbetragsstufe, 3, 'CH')
|
55
|
+
package.add_code(code)
|
56
|
+
code = Util::Code.new(:zuzahlungsbefreit, true, 'CH')
|
57
|
+
package.add_code(code)
|
58
|
+
part = Drugs::Part.new
|
59
|
+
part.package = package
|
60
|
+
part.size = 5
|
61
|
+
part.composition = composition
|
62
|
+
unit = Drugs::Unit.new
|
63
|
+
unit.name.de = 'Ampullen'
|
64
|
+
part.unit = unit
|
65
|
+
package.name.de = name
|
66
|
+
package.sequence = sequence
|
67
|
+
package.add_price(Business::Price.new(:public, 'CH', price))
|
68
|
+
package.add_price(Business::Price.new(:festbetrag, 'CH', 10))
|
69
|
+
package.add_code(Util::Code.new(:cid, pzn, 'CH'))
|
70
|
+
package.save
|
71
|
+
package
|
72
|
+
end
|
73
|
+
def setup_remote_package(name, uid='55555', price=12)
|
74
|
+
rpackage = flexmock('Remote Package')
|
75
|
+
rpackage.should_receive(:name_base).and_return(name)
|
76
|
+
rpackage.should_receive(:price_public).and_return {
|
77
|
+
price
|
78
|
+
}
|
79
|
+
rpackage.should_receive(:price_exfactory).and_return nil
|
80
|
+
rpackage.should_receive(:comparable_size)\
|
81
|
+
.and_return(Drugs::Dose.new(4))
|
82
|
+
rpackage.should_receive(:__drbref).and_return(uid)
|
83
|
+
rcompany = flexmock('Remote Company')
|
84
|
+
rpackage.should_receive(:company).and_return(rcompany)
|
85
|
+
rcompany.should_receive(:name).and_return('Producer (Schweiz) AG')
|
86
|
+
ratc = flexmock('Remote Atc Class')
|
87
|
+
ratc.should_receive(:ddds).and_return []
|
88
|
+
rpackage.should_receive(:atc_class).and_return(ratc)
|
89
|
+
ratc.should_receive(:code).and_return('N04BB01')
|
90
|
+
ratc.should_receive(:de).and_return('Amantadine')
|
91
|
+
ragent = flexmock('Remote ActiveAgent')
|
92
|
+
rpackage.should_receive(:active_agents).and_return([ragent])
|
93
|
+
rsubstance = flexmock('Remote Substance')
|
94
|
+
ragent.should_receive(:dose).and_return(Drugs::Dose.new(100, 'mg'))
|
95
|
+
ragent.should_receive(:substance).and_return(rsubstance)
|
96
|
+
rsubstance.should_receive(:de).and_return('Amantadinum')
|
97
|
+
rgalform = flexmock('Remote Galenic Form')
|
98
|
+
rpackage.should_receive(:galenic_forms).and_return([rgalform])
|
99
|
+
rgalform.should_receive(:de).and_return('Tropfen-Ampullen')
|
100
|
+
rgroup = flexmock('Remote Galenic Group')
|
101
|
+
rgroup.should_receive(:de).and_return('Tropfen')
|
102
|
+
rgalform.should_receive(:galenic_group).and_return(rgroup)
|
103
|
+
rpart = flexmock('Remote Part')
|
104
|
+
rpart.should_receive(:comparable_size)\
|
105
|
+
.and_return(Drugs::Dose.new(4))
|
106
|
+
rpart.should_ignore_missing
|
107
|
+
rpackage.should_receive(:parts).and_return [rpart]
|
108
|
+
@cache.should_receive(:fetch).with(uid.to_i).and_return(rpackage)
|
109
|
+
rpackage.should_ignore_missing
|
110
|
+
rpackage
|
111
|
+
end
|
112
|
+
def teardown
|
113
|
+
super
|
114
|
+
ODDB.config.remote_databases = []
|
115
|
+
@currency.stop_service
|
116
|
+
end
|
117
|
+
def test_init
|
118
|
+
package = setup_package("Amantadin by Producer")
|
119
|
+
open "/"
|
120
|
+
assert_equal "CH - ODDB.org | Medikamente | Home | Open Drug Database", get_title
|
121
|
+
type "query", "Amantadin"
|
122
|
+
click "//input[@type='submit']"
|
123
|
+
wait_for_page_to_load 30
|
124
|
+
assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Markenname | Open Drug Database",
|
125
|
+
get_title
|
126
|
+
click 'link=Amantadin by Producer'
|
127
|
+
wait_for_page_to_load 30
|
128
|
+
|
129
|
+
assert_equal "CH - ODDB.org | Medikamente | Preisvergleich | Amantadin by Producer | Open Drug Database", get_title
|
130
|
+
assert is_text_present('Amantadin by Producer')
|
131
|
+
assert is_text_present('Amantadin 100 mg')
|
132
|
+
assert is_text_present('5 Ampullen')
|
133
|
+
assert is_text_present('6.00')
|
134
|
+
assert is_text_present("In unserer Datenbank wurden leider keine Produkte gefunden, die mit diesem Produkt verglichen werden können.")
|
135
|
+
end
|
136
|
+
def test_compare
|
137
|
+
package1 = setup_package("Amantadin by Producer", '12345', 6)
|
138
|
+
package2 = setup_package("By another name", '54321', 3)
|
139
|
+
package2.code(:zuzahlungsbefreit).value = false
|
140
|
+
flexstub(package1).should_receive(:comparables)\
|
141
|
+
.and_return([package2])
|
142
|
+
flexstub(package2).should_receive(:comparables)\
|
143
|
+
.and_return([package1])
|
144
|
+
open "/de/drugs/compare/cid/12345"
|
145
|
+
assert_equal "CH - ODDB.org | Medikamente | Preisvergleich | Amantadin by Producer | Open Drug Database", get_title
|
146
|
+
assert is_text_present('-50.0%')
|
147
|
+
assert_equal 'origin zuzahlungsbefreit',
|
148
|
+
get_attribute('//tr[2]@class')
|
149
|
+
assert_raises(::Selenium::CommandError) { get_attribute('//tr[3]@class') }
|
150
|
+
|
151
|
+
|
152
|
+
click 'link=By another name'
|
153
|
+
wait_for_page_to_load 30
|
154
|
+
assert_equal "CH - ODDB.org | Medikamente | Preisvergleich | By another name | Open Drug Database", get_title
|
155
|
+
assert is_text_present('+100.0%')
|
156
|
+
assert_equal 'origin',
|
157
|
+
get_attribute('//tr[2]@class')
|
158
|
+
assert_equal 'zuzahlungsbefreit', get_attribute('//tr[3]@class')
|
159
|
+
assert is_text_present('Gelb = Zuzahlungsbefreit')
|
160
|
+
assert !is_text_present('Rot = CH - Produkte')
|
161
|
+
end
|
162
|
+
def test_compare__limited
|
163
|
+
ODDB.config.query_limit = 1
|
164
|
+
package1 = setup_package("Amantadin by Producer", '12345', 6)
|
165
|
+
package2 = setup_package("By another name", '54321', 3)
|
166
|
+
package2.code(:zuzahlungsbefreit).value = false
|
167
|
+
flexstub(package1).should_receive(:comparables)\
|
168
|
+
.and_return([package2])
|
169
|
+
flexstub(package2).should_receive(:comparables)\
|
170
|
+
.and_return([package1])
|
171
|
+
open "/de/drugs/compare/cid/12345"
|
172
|
+
assert_equal "CH - ODDB.org | Medikamente | Preisvergleich | Amantadin by Producer | Open Drug Database", get_title
|
173
|
+
assert is_text_present('-50.0%')
|
174
|
+
assert_equal 'origin zuzahlungsbefreit',
|
175
|
+
get_attribute('//tr[2]@class')
|
176
|
+
assert_raises(::Selenium::CommandError) { get_attribute('//tr[3]@class') }
|
177
|
+
|
178
|
+
|
179
|
+
click 'link=By another name'
|
180
|
+
wait_for_page_to_load 30
|
181
|
+
assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
|
182
|
+
get_title
|
183
|
+
assert is_text_present("Abfragebeschränkung")
|
184
|
+
ensure
|
185
|
+
ODDB.config.query_limit = 20
|
186
|
+
end
|
187
|
+
def test_sort
|
188
|
+
package1 = setup_package("Amantadin by Producer", '12345', 6)
|
189
|
+
package2 = setup_package("By another name", '54321', 6)
|
190
|
+
package3 = setup_package("Yet another", '11111', 3)
|
191
|
+
flexstub(package1).should_receive(:comparables)\
|
192
|
+
.and_return([package2, package3])
|
193
|
+
open "/de/drugs/compare/cid/12345"
|
194
|
+
assert_equal "CH - ODDB.org | Medikamente | Preisvergleich | Amantadin by Producer | Open Drug Database", get_title
|
195
|
+
assert_match(/^Yet another/, @selenium.get_text("cid_N04BB01_0"))
|
196
|
+
assert_match(/^By another name/, @selenium.get_text("cid_N04BB01_1"))
|
197
|
+
|
198
|
+
click "//a[@name='th_product']"
|
199
|
+
wait_for_page_to_load 30
|
200
|
+
assert_equal "CH - ODDB.org | Medikamente | Preisvergleich | Amantadin by Producer | Open Drug Database", get_title
|
201
|
+
assert_match(/^By another name/, @selenium.get_text("cid_N04BB01_0"))
|
202
|
+
assert_match(/^Yet another/, @selenium.get_text("cid_N04BB01_1"))
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|