ramaze.ch.oddb.org 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. data/History.txt +6 -0
  2. data/LICENSE +339 -0
  3. data/Manifest.txt +285 -0
  4. data/README.txt +45 -0
  5. data/Rakefile +28 -0
  6. data/bin/admin +69 -0
  7. data/bin/exportd +63 -0
  8. data/bin/migrate +461 -0
  9. data/bin/oddbd +62 -0
  10. data/data/fulltext/data/dicts/french/fulltext.aff +1057 -0
  11. data/data/fulltext/data/dicts/french/fulltext.dict +91189 -0
  12. data/data/fulltext/data/dicts/french/fulltext.stop +135 -0
  13. data/data/fulltext/data/dicts/german/fulltext.aff +1233 -0
  14. data/data/fulltext/data/dicts/german/fulltext.dict +287574 -0
  15. data/data/fulltext/data/dicts/german/fulltext.stop +133 -0
  16. data/data/fulltext/data/german_compound/README +15 -0
  17. data/data/fulltext/data/german_compound/compound.pl +63 -0
  18. data/data/fulltext/data/german_compound/german.stop +20 -0
  19. data/data/fulltext/data/ispell-german-compound.tar.gz +0 -0
  20. data/data/fulltext/redist/dict_french/Makefile +12 -0
  21. data/data/fulltext/redist/dict_french/README.french +1 -0
  22. data/data/fulltext/redist/dict_french/dict_french.sql.in +7 -0
  23. data/data/fulltext/redist/dict_french/dict_snowball.c +56 -0
  24. data/data/fulltext/redist/dict_french/french_stem.c +1222 -0
  25. data/data/fulltext/redist/dict_french/french_stem.h +16 -0
  26. data/data/fulltext/redist/dict_french/subinclude.h +2 -0
  27. data/data/fulltext/redist/dict_german/Makefile +12 -0
  28. data/data/fulltext/redist/dict_german/README.german +1 -0
  29. data/data/fulltext/redist/dict_german/dict_german.sql.in +7 -0
  30. data/data/fulltext/redist/dict_german/dict_snowball.c +56 -0
  31. data/data/fulltext/redist/dict_german/german_stem.c +527 -0
  32. data/data/fulltext/redist/dict_german/german_stem.h +16 -0
  33. data/data/fulltext/redist/dict_german/subinclude.h +1 -0
  34. data/data/fulltext/redist/french_stem.c +1222 -0
  35. data/data/fulltext/redist/french_stem.h +16 -0
  36. data/data/fulltext/redist/german_stem.c +527 -0
  37. data/data/fulltext/redist/german_stem.h +16 -0
  38. data/lib/fixes/ruby19.rb +21 -0
  39. data/lib/fixes/selenium.rb +20 -0
  40. data/lib/fixes/singular.rb +8 -0
  41. data/lib/fixes/yaml.rb +13 -0
  42. data/lib/oddb.rb +11 -0
  43. data/lib/oddb/business/company.rb +18 -0
  44. data/lib/oddb/business/invoice.rb +75 -0
  45. data/lib/oddb/business/price.rb +60 -0
  46. data/lib/oddb/config.rb +73 -0
  47. data/lib/oddb/drugs.rb +16 -0
  48. data/lib/oddb/drugs/active_agent.rb +37 -0
  49. data/lib/oddb/drugs/atc.rb +53 -0
  50. data/lib/oddb/drugs/composition.rb +41 -0
  51. data/lib/oddb/drugs/ddd.rb +24 -0
  52. data/lib/oddb/drugs/dose.rb +107 -0
  53. data/lib/oddb/drugs/galenic_form.rb +21 -0
  54. data/lib/oddb/drugs/galenic_group.rb +17 -0
  55. data/lib/oddb/drugs/package.rb +87 -0
  56. data/lib/oddb/drugs/part.rb +56 -0
  57. data/lib/oddb/drugs/product.rb +25 -0
  58. data/lib/oddb/drugs/sequence.rb +61 -0
  59. data/lib/oddb/drugs/substance.rb +31 -0
  60. data/lib/oddb/drugs/substance_group.rb +13 -0
  61. data/lib/oddb/drugs/unit.rb +12 -0
  62. data/lib/oddb/export.rb +4 -0
  63. data/lib/oddb/export/csv.rb +89 -0
  64. data/lib/oddb/export/l10n_sessions.rb +30 -0
  65. data/lib/oddb/export/rss.rb +44 -0
  66. data/lib/oddb/export/server.rb +58 -0
  67. data/lib/oddb/export/xls.rb +119 -0
  68. data/lib/oddb/export/yaml.rb +123 -0
  69. data/lib/oddb/html/state/drugs/admin/package.rb +189 -0
  70. data/lib/oddb/html/state/drugs/admin/product.rb +56 -0
  71. data/lib/oddb/html/state/drugs/admin/sequence.rb +259 -0
  72. data/lib/oddb/html/state/drugs/ajax/explain_ddd_price.rb +19 -0
  73. data/lib/oddb/html/state/drugs/ajax/explain_price.rb +19 -0
  74. data/lib/oddb/html/state/drugs/ajax/global.rb +18 -0
  75. data/lib/oddb/html/state/drugs/ajax/package_infos.rb +19 -0
  76. data/lib/oddb/html/state/drugs/ajax/remote_infos.rb +19 -0
  77. data/lib/oddb/html/state/drugs/atc_browser.rb +39 -0
  78. data/lib/oddb/html/state/drugs/atc_guidelines.rb +21 -0
  79. data/lib/oddb/html/state/drugs/compare.rb +52 -0
  80. data/lib/oddb/html/state/drugs/download_export.rb +18 -0
  81. data/lib/oddb/html/state/drugs/fachinfo.rb +21 -0
  82. data/lib/oddb/html/state/drugs/feedback.rb +94 -0
  83. data/lib/oddb/html/state/drugs/global.rb +266 -0
  84. data/lib/oddb/html/state/drugs/init.rb +18 -0
  85. data/lib/oddb/html/state/drugs/login.rb +17 -0
  86. data/lib/oddb/html/state/drugs/package.rb +32 -0
  87. data/lib/oddb/html/state/drugs/patinfo.rb +21 -0
  88. data/lib/oddb/html/state/drugs/products.rb +51 -0
  89. data/lib/oddb/html/state/drugs/result.rb +125 -0
  90. data/lib/oddb/html/state/global.rb +165 -0
  91. data/lib/oddb/html/state/global_predefine.rb +17 -0
  92. data/lib/oddb/html/state/limit.rb +17 -0
  93. data/lib/oddb/html/state/login.rb +56 -0
  94. data/lib/oddb/html/state/paypal/checkout.rb +130 -0
  95. data/lib/oddb/html/state/paypal/collect.rb +46 -0
  96. data/lib/oddb/html/state/paypal/redirect.rb +18 -0
  97. data/lib/oddb/html/state/register_export.rb +38 -0
  98. data/lib/oddb/html/state/register_poweruser.rb +17 -0
  99. data/lib/oddb/html/state/viral/admin.rb +76 -0
  100. data/lib/oddb/html/state/viral/poweruser.rb +16 -0
  101. data/lib/oddb/html/util/annotated_list.rb +39 -0
  102. data/lib/oddb/html/util/know_it_all.rb +28 -0
  103. data/lib/oddb/html/util/known_user.rb +55 -0
  104. data/lib/oddb/html/util/lookandfeel.rb +554 -0
  105. data/lib/oddb/html/util/need_all_input.rb +29 -0
  106. data/lib/oddb/html/util/session.rb +88 -0
  107. data/lib/oddb/html/util/sort.rb +72 -0
  108. data/lib/oddb/html/util/unsaved_helper.rb +20 -0
  109. data/lib/oddb/html/util/validator.rb +54 -0
  110. data/lib/oddb/html/view/ajax/json.rb +22 -0
  111. data/lib/oddb/html/view/alpha_header.rb +28 -0
  112. data/lib/oddb/html/view/document.rb +126 -0
  113. data/lib/oddb/html/view/drugs/admin/package.rb +237 -0
  114. data/lib/oddb/html/view/drugs/admin/product.rb +104 -0
  115. data/lib/oddb/html/view/drugs/admin/sequence.rb +312 -0
  116. data/lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb +87 -0
  117. data/lib/oddb/html/view/drugs/ajax/explain_price.rb +61 -0
  118. data/lib/oddb/html/view/drugs/ajax/package_infos.rb +105 -0
  119. data/lib/oddb/html/view/drugs/ajax/remote_infos.rb +44 -0
  120. data/lib/oddb/html/view/drugs/atc_browser.rb +68 -0
  121. data/lib/oddb/html/view/drugs/atc_guidelines.rb +94 -0
  122. data/lib/oddb/html/view/drugs/compare.rb +95 -0
  123. data/lib/oddb/html/view/drugs/download_export.rb +28 -0
  124. data/lib/oddb/html/view/drugs/fachinfo.rb +46 -0
  125. data/lib/oddb/html/view/drugs/feedback.rb +231 -0
  126. data/lib/oddb/html/view/drugs/init.rb +51 -0
  127. data/lib/oddb/html/view/drugs/legend.rb +24 -0
  128. data/lib/oddb/html/view/drugs/package.rb +398 -0
  129. data/lib/oddb/html/view/drugs/patinfo.rb +46 -0
  130. data/lib/oddb/html/view/drugs/products.rb +97 -0
  131. data/lib/oddb/html/view/drugs/result.rb +296 -0
  132. data/lib/oddb/html/view/drugs/search.rb +33 -0
  133. data/lib/oddb/html/view/drugs/template.rb +15 -0
  134. data/lib/oddb/html/view/foot.rb +52 -0
  135. data/lib/oddb/html/view/google.rb +23 -0
  136. data/lib/oddb/html/view/google_ads.rb +40 -0
  137. data/lib/oddb/html/view/head.rb +78 -0
  138. data/lib/oddb/html/view/limit.rb +109 -0
  139. data/lib/oddb/html/view/list.rb +59 -0
  140. data/lib/oddb/html/view/login.rb +38 -0
  141. data/lib/oddb/html/view/navigation.rb +67 -0
  142. data/lib/oddb/html/view/offset_header.rb +35 -0
  143. data/lib/oddb/html/view/paypal/collect.rb +84 -0
  144. data/lib/oddb/html/view/paypal/redirect.rb +51 -0
  145. data/lib/oddb/html/view/paypal/register_form.rb +106 -0
  146. data/lib/oddb/html/view/register_export.rb +29 -0
  147. data/lib/oddb/html/view/register_poweruser.rb +29 -0
  148. data/lib/oddb/html/view/rss/feedback.rb +64 -0
  149. data/lib/oddb/html/view/rss_preview.rb +54 -0
  150. data/lib/oddb/html/view/search.rb +104 -0
  151. data/lib/oddb/html/view/snapback.rb +24 -0
  152. data/lib/oddb/html/view/template.rb +56 -0
  153. data/lib/oddb/import/excel.rb +45 -0
  154. data/lib/oddb/import/import.rb +39 -0
  155. data/lib/oddb/import/rtf.rb +410 -0
  156. data/lib/oddb/import/whocc.rb +173 -0
  157. data/lib/oddb/import/xml.rb +15 -0
  158. data/lib/oddb/model.rb +179 -0
  159. data/lib/oddb/persistence/odba.rb +33 -0
  160. data/lib/oddb/persistence/odba/business/company.rb +13 -0
  161. data/lib/oddb/persistence/odba/business/invoice.rb +15 -0
  162. data/lib/oddb/persistence/odba/drugs/atc.rb +15 -0
  163. data/lib/oddb/persistence/odba/drugs/galenic_form.rb +18 -0
  164. data/lib/oddb/persistence/odba/drugs/galenic_group.rb +13 -0
  165. data/lib/oddb/persistence/odba/drugs/package.rb +25 -0
  166. data/lib/oddb/persistence/odba/drugs/product.rb +13 -0
  167. data/lib/oddb/persistence/odba/drugs/sequence.rb +21 -0
  168. data/lib/oddb/persistence/odba/drugs/substance.rb +21 -0
  169. data/lib/oddb/persistence/odba/drugs/substance_group.rb +13 -0
  170. data/lib/oddb/persistence/odba/drugs/unit.rb +13 -0
  171. data/lib/oddb/persistence/odba/export.rb +26 -0
  172. data/lib/oddb/persistence/odba/model.rb +68 -0
  173. data/lib/oddb/persistence/odba/regulatory/authority.rb +13 -0
  174. data/lib/oddb/persistence/odba/regulatory/registration.rb +13 -0
  175. data/lib/oddb/persistence/odba/text/document.rb +11 -0
  176. data/lib/oddb/persistence/odba/util/code.rb +11 -0
  177. data/lib/oddb/persistence/odba/util/m10l_document.rb +13 -0
  178. data/lib/oddb/persistence/og.rb +16 -0
  179. data/lib/oddb/persistence/og/drugs/composition.rb +14 -0
  180. data/lib/oddb/persistence/og/drugs/product.rb +14 -0
  181. data/lib/oddb/persistence/og/drugs/sequence.rb +15 -0
  182. data/lib/oddb/persistence/og/model.rb +25 -0
  183. data/lib/oddb/persistence/og/util/multilingual.rb +13 -0
  184. data/lib/oddb/redist/rtf_tools/reader.rb +139 -0
  185. data/lib/oddb/regulatory/authority.rb +14 -0
  186. data/lib/oddb/regulatory/registration.rb +15 -0
  187. data/lib/oddb/remote/business/company.rb +23 -0
  188. data/lib/oddb/remote/drugs/active_agent.rb +27 -0
  189. data/lib/oddb/remote/drugs/atc.rb +32 -0
  190. data/lib/oddb/remote/drugs/dose.rb +8 -0
  191. data/lib/oddb/remote/drugs/galenic_form.rb +25 -0
  192. data/lib/oddb/remote/drugs/package.rb +126 -0
  193. data/lib/oddb/remote/drugs/part.rb +30 -0
  194. data/lib/oddb/remote/drugs/product.rb +19 -0
  195. data/lib/oddb/remote/drugs/sequence.rb +46 -0
  196. data/lib/oddb/remote/drugs/substance.rb +20 -0
  197. data/lib/oddb/remote/drugs/unit.rb +19 -0
  198. data/lib/oddb/remote/object.rb +36 -0
  199. data/lib/oddb/remote/text/document.rb +20 -0
  200. data/lib/oddb/remote/util/m10l_document.rb +22 -0
  201. data/lib/oddb/text/chapter.rb +27 -0
  202. data/lib/oddb/text/document.rb +43 -0
  203. data/lib/oddb/text/format.rb +37 -0
  204. data/lib/oddb/text/paragraph.rb +58 -0
  205. data/lib/oddb/text/picture.rb +93 -0
  206. data/lib/oddb/text/table.rb +68 -0
  207. data/lib/oddb/util.rb +8 -0
  208. data/lib/oddb/util/annotated_list.rb +37 -0
  209. data/lib/oddb/util/code.rb +69 -0
  210. data/lib/oddb/util/comparison.rb +36 -0
  211. data/lib/oddb/util/exporter.rb +8 -0
  212. data/lib/oddb/util/feedback.rb +23 -0
  213. data/lib/oddb/util/ipn.rb +48 -0
  214. data/lib/oddb/util/m10l_document.rb +38 -0
  215. data/lib/oddb/util/mail.rb +73 -0
  216. data/lib/oddb/util/money.rb +60 -0
  217. data/lib/oddb/util/multilingual.rb +70 -0
  218. data/lib/oddb/util/quanty.rb +4 -0
  219. data/lib/oddb/util/quanty/fact.rb +229 -0
  220. data/lib/oddb/util/quanty/main.rb +160 -0
  221. data/lib/oddb/util/quanty/parse.rb +853 -0
  222. data/lib/oddb/util/quanty/units.dump +0 -0
  223. data/lib/oddb/util/server.rb +117 -0
  224. data/lib/oddb/util/updater.rb +41 -0
  225. data/lib/oddb/util/ydim.rb +110 -0
  226. data/lib/oddb/util/yus.rb +46 -0
  227. data/test/business/test_company.rb +29 -0
  228. data/test/business/test_price.rb +46 -0
  229. data/test/drugs/test_active_agent.rb +53 -0
  230. data/test/drugs/test_atc.rb +54 -0
  231. data/test/drugs/test_composition.rb +88 -0
  232. data/test/drugs/test_ddd.rb +22 -0
  233. data/test/drugs/test_dose.rb +190 -0
  234. data/test/drugs/test_galenic_form.rb +41 -0
  235. data/test/drugs/test_package.rb +173 -0
  236. data/test/drugs/test_part.rb +32 -0
  237. data/test/drugs/test_product.rb +31 -0
  238. data/test/drugs/test_sequence.rb +140 -0
  239. data/test/drugs/test_substance.rb +51 -0
  240. data/test/drugs/test_substance_group.rb +27 -0
  241. data/test/export/test_rss.rb +94 -0
  242. data/test/export/test_server.rb +117 -0
  243. data/test/export/test_xls.rb +152 -0
  244. data/test/export/test_yaml.rb +120 -0
  245. data/test/import/data/html/whocc/A.html +56 -0
  246. data/test/import/data/html/whocc/A03.html +48 -0
  247. data/test/import/data/html/whocc/A03AB.html +48 -0
  248. data/test/import/data/html/whocc/A06AA.html +47 -0
  249. data/test/import/data/html/whocc/C03.html +47 -0
  250. data/test/import/data/html/whocc/login.html +77 -0
  251. data/test/import/data/xml/ATC_2006.xml +47 -0
  252. data/test/import/data/xml/ATC_2006_ddd.xml +35 -0
  253. data/test/import/test_excel.rb +34 -0
  254. data/test/import/test_rtf.rb +40 -0
  255. data/test/import/test_whocc.rb +315 -0
  256. data/test/remote/drugs/test_active_agent.rb +36 -0
  257. data/test/selenium/selenium-server.jar +0 -0
  258. data/test/selenium/test_atc_browser.rb +122 -0
  259. data/test/selenium/test_atc_guidelines.rb +96 -0
  260. data/test/selenium/test_collect.rb +138 -0
  261. data/test/selenium/test_compare.rb +206 -0
  262. data/test/selenium/test_fachinfo.rb +130 -0
  263. data/test/selenium/test_feedback.rb +196 -0
  264. data/test/selenium/test_init.rb +52 -0
  265. data/test/selenium/test_limit.rb +305 -0
  266. data/test/selenium/test_login.rb +67 -0
  267. data/test/selenium/test_package.rb +512 -0
  268. data/test/selenium/test_patinfo.rb +131 -0
  269. data/test/selenium/test_product.rb +80 -0
  270. data/test/selenium/test_products.rb +142 -0
  271. data/test/selenium/test_search.rb +715 -0
  272. data/test/selenium/test_sequence.rb +543 -0
  273. data/test/selenium/unit.rb +185 -0
  274. data/test/stub/http_server.rb +169 -0
  275. data/test/stub/model.rb +173 -0
  276. data/test/suite.rb +15 -0
  277. data/test/test_model.rb +83 -0
  278. data/test/util/test_code.rb +74 -0
  279. data/test/util/test_ipn.rb +117 -0
  280. data/test/util/test_mail.rb +86 -0
  281. data/test/util/test_multilingual.rb +97 -0
  282. data/test/util/test_server.rb +48 -0
  283. data/test/util/test_updater.rb +353 -0
  284. data/test/util/test_ydim.rb +115 -0
  285. data/test/util/test_yus.rb +79 -0
  286. metadata +418 -0
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # Selenium::TestFachinfo -- de.oddb.org -- 01.11.2007 -- hwyss@ywesee.com
4
+
5
+
6
+ $: << File.expand_path('..', File.dirname(__FILE__))
7
+
8
+ require 'selenium/unit'
9
+ require 'stub/model'
10
+ require 'oddb/drugs'
11
+ require 'oddb/util'
12
+ require 'oddb/text'
13
+
14
+ module ODDB
15
+ module Selenium
16
+ class TestFachinfo < Test::Unit::TestCase
17
+ include Selenium::TestCase
18
+ def setup
19
+ Drugs::Package.instances.clear
20
+ super
21
+ end
22
+ def setup_package(pzn='12345')
23
+ product = Drugs::Product.new
24
+ company = Business::Company.new
25
+ company.name.de = 'Producer AG'
26
+ product.company = company
27
+ product.name.de = "Amantadin by Producer"
28
+ company.save
29
+ sequence = Drugs::Sequence.new
30
+ sequence.atc = Drugs::Atc.new('N04BB01')
31
+ sequence.atc.name.de = 'Amantadin'
32
+ ddd = Drugs::Ddd.new('O')
33
+ ddd.dose = Drugs::Dose.new(5, 'mg')
34
+ sequence.atc.add_ddd(ddd)
35
+ sequence.product = product
36
+ composition = Drugs::Composition.new
37
+ composition.equivalence_factor = '44.6'
38
+ sequence.add_composition(composition)
39
+ substance = Drugs::Substance.new
40
+ substance.name.de = "Amantadin"
41
+ dose = Drugs::Dose.new(100, 'mg')
42
+ active_agent = Drugs::ActiveAgent.new(substance, dose)
43
+ composition.add_active_agent(active_agent)
44
+ package = Drugs::Package.new
45
+ code = Util::Code.new(:festbetragsstufe, 3, 'CH')
46
+ package.add_code(code)
47
+ code = Util::Code.new(:zuzahlungsbefreit, true, 'CH')
48
+ package.add_code(code)
49
+ code = Util::Code.new(:prescription, true, 'CH')
50
+ package.add_code(code)
51
+ code = Util::Code.new(:cid, pzn, 'CH')
52
+ package.add_code(code)
53
+ part = Drugs::Part.new
54
+ part.composition = composition
55
+ part.package = package
56
+ part.size = 5
57
+ unit = Drugs::Unit.new
58
+ unit.name.de = 'Ampullen'
59
+ part.unit = unit
60
+ part.quantity = Drugs::Dose.new(20, 'ml')
61
+ package.name.de = 'Amantadin by Producer'
62
+ package.sequence = sequence
63
+ package.add_price(Business::Price.new(:public, 'CH', 6))
64
+ package.add_price(Business::Price.new(:festbetrag, 'CH', 10))
65
+ package.save
66
+ package
67
+ end
68
+ def setup_fachinfo
69
+ document = Text::Document.new
70
+ chapter = Text::Chapter.new('name')
71
+ paragraph = Text::Paragraph.new
72
+ paragraph.set_format("b")
73
+ paragraph << "1. Bezeichnung"
74
+ chapter.add_paragraph paragraph
75
+ paragraph = Text::Paragraph.new
76
+ paragraph << "Amantadin Product"
77
+ chapter.add_paragraph paragraph
78
+ document.add_chapter(chapter)
79
+ chapter = Text::Chapter.new('composition')
80
+ paragraph = Text::Paragraph.new
81
+ paragraph.set_format("b")
82
+ paragraph << "2. Zusammensetzung"
83
+ chapter.add_paragraph paragraph
84
+ table = Text::Table.new
85
+ table << "Für Kinder"
86
+ table.next_cell!
87
+ table << "Für Erwachsene"
88
+ table.next_row!
89
+ table << "10 mg Amantadin pro Tablette"
90
+ table.next_cell!
91
+ table << "100 mg Amantadin pro Tablette"
92
+ chapter.add_paragraph table
93
+ document.add_chapter(chapter)
94
+ chapter = Text::Chapter.new('packaging')
95
+ paragraph = Text::Paragraph.new
96
+ paragraph.set_format("b")
97
+ paragraph << "6.1"
98
+ paragraph.set_format()
99
+ paragraph << " Behältnis"
100
+ chapter.add_paragraph paragraph
101
+ picture = Text::Picture.new
102
+ flexmock(picture).should_receive(:path).and_return('/resources/oddb/logo.png')
103
+ flexmock(picture).should_receive(:filename).and_return('logo.png')
104
+ chapter.add_paragraph picture
105
+ document.add_chapter(chapter)
106
+ document
107
+ end
108
+ def test_fachinfo
109
+ package = setup_package
110
+ package.fachinfo.de = setup_fachinfo
111
+ open "/de/drugs/fachinfo/uid/#{package.sequence.uid}"
112
+ assert_equal "CH - ODDB.org | Medikamente | Fachinformation | Amantadin by Producer | Open Drug Database", get_title
113
+ assert is_text_present("1. Bezeichnung\nAmantadin Product")
114
+ end
115
+ def test_fachinfo__limited
116
+ ODDB.config.query_limit = 1
117
+ package = setup_package
118
+ package.fachinfo.de = setup_fachinfo
119
+ open "/de/drugs/fachinfo/uid/#{package.sequence.uid}"
120
+ assert_equal "CH - ODDB.org | Medikamente | Fachinformation | Amantadin by Producer | Open Drug Database", get_title
121
+ open "/de/drugs/fachinfo/uid/#{package.sequence.uid}"
122
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
123
+ get_title
124
+ assert is_text_present("Abfragebeschränkung")
125
+ ensure
126
+ ODDB.config.query_limit = 20
127
+ end
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,196 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # Selenium::TestFeedback -- de.oddb.org -- 11.12.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
+
12
+ module ODDB
13
+ module Selenium
14
+ class TestFeedback < Test::Unit::TestCase
15
+ include Selenium::TestCase
16
+ def setup
17
+ ODDB.config.data_dir = File.expand_path('../../data', File.dirname(__FILE__))
18
+ ODDB.config.var = File.expand_path('var', File.dirname(__FILE__))
19
+ @path = File.join(ODDB.config.var, 'rss', 'de', 'feedback.rss')
20
+ File.delete(@path) if(File.exist? @path)
21
+ super
22
+ end
23
+ def teardown
24
+ Drugs::Package.instances.clear
25
+ super
26
+ end
27
+ def setup_package(pzn='12345')
28
+ product = Drugs::Product.new
29
+ company = Business::Company.new
30
+ company.name.de = 'Producer AG'
31
+ product.company = company
32
+ company.save
33
+ sequence = Drugs::Sequence.new
34
+ sequence.atc = Drugs::Atc.new('N04BB01')
35
+ sequence.atc.name.de = 'Amantadin'
36
+ ddd = Drugs::Ddd.new('O')
37
+ ddd.dose = Drugs::Dose.new(5, 'mg')
38
+ sequence.atc.add_ddd(ddd)
39
+ sequence.product = product
40
+ composition = Drugs::Composition.new
41
+ composition.equivalence_factor = '44.6'
42
+ sequence.add_composition(composition)
43
+ substance = Drugs::Substance.new
44
+ substance.name.de = "Amantadin"
45
+ dose = Drugs::Dose.new(100, 'mg')
46
+ active_agent = Drugs::ActiveAgent.new(substance, dose)
47
+ composition.add_active_agent(active_agent)
48
+ package = Drugs::Package.new
49
+ code = Util::Code.new(:festbetragsstufe, 3, 'CH')
50
+ package.add_code(code)
51
+ code = Util::Code.new(:zuzahlungsbefreit, true, 'CH')
52
+ package.add_code(code)
53
+ code = Util::Code.new(:prescription, true, 'CH')
54
+ package.add_code(code)
55
+ code = Util::Code.new(:cid, pzn, 'CH')
56
+ package.add_code(code)
57
+ part = Drugs::Part.new
58
+ part.composition = composition
59
+ part.package = package
60
+ part.size = 5
61
+ unit = Drugs::Unit.new
62
+ unit.name.de = 'Ampullen'
63
+ part.unit = unit
64
+ part.quantity = Drugs::Dose.new(20, 'ml')
65
+ package.name.de = 'Amantadin by Producer'
66
+ package.sequence = sequence
67
+ package.add_price(Business::Price.new(:public, 'CH', 6))
68
+ package.add_price(Business::Price.new(:festbetrag, 'CH', 10))
69
+ package.save
70
+ package
71
+ end
72
+ def test_feedback
73
+ package = setup_package
74
+ open "/de/drugs/feedback/cid/12345"
75
+ assert_equal "CH - ODDB.org | Medikamente | Feedback | Amantadin by Producer | Open Drug Database", get_title
76
+ assert is_text_present('Feedback zu Amantadin by Producer in der Handelsform: 5 Ampullen à 20 ml')
77
+ assert is_element_present('name')
78
+ assert is_element_present('email')
79
+ assert is_element_present('email_public')
80
+ assert is_element_present('message')
81
+ assert is_element_present('item_good_experience')
82
+ assert is_element_present('item_recommended')
83
+ assert is_element_present('item_good_impression')
84
+ assert is_element_present('item_helps')
85
+ ## Captcha temporarily disabled
86
+ # assert is_text_present("Was steht im Bild unten?")
87
+ end
88
+ def test_feedback__errors
89
+ package = setup_package
90
+ open "/de/drugs/feedback/cid/12345"
91
+ assert_equal "CH - ODDB.org | Medikamente | Feedback | Amantadin by Producer | Open Drug Database", get_title
92
+ assert is_text_present('Feedback zu Amantadin by Producer in der Handelsform: 5 Ampullen à 20 ml')
93
+ assert is_element_present('name')
94
+ assert is_element_present('email')
95
+ assert is_element_present('email_public')
96
+ assert is_element_present('message')
97
+ assert is_element_present('item_good_experience')
98
+ assert is_element_present('item_recommended')
99
+ assert is_element_present('item_good_impression')
100
+ assert is_element_present('item_helps')
101
+ ## Captcha temporarily disabled
102
+ # assert is_text_present("Was steht im Bild unten?")
103
+ # assert is_element_present("//input[starts-with(@name, 'captcha')]")
104
+ click "//input[@type='submit']"
105
+ wait_for_page_to_load 30
106
+ # assert is_text_present('Ihre Eingabe stimmt nicht mit dem Bild überein. Bitte versuchen Sie es noch einmal.')
107
+ assert is_text_present('Bitte füllen Sie alle Felder aus.')
108
+ assert is_element_present('name')
109
+ assert is_element_present('email')
110
+ assert is_element_present('email_public')
111
+ assert is_element_present('message')
112
+ assert is_element_present('item_good_experience')
113
+ assert is_element_present('item_recommended')
114
+ assert is_element_present('item_good_impression')
115
+ assert is_element_present('item_helps')
116
+ # assert is_text_present("Was steht im Bild unten?")
117
+ # assert is_element_present("//input[starts-with(@name, 'captcha')]")
118
+ end
119
+ def test_feedback__success
120
+ flexmock(Turing::Challenge).new_instances\
121
+ .should_receive(:valid_answer?).and_return(true)
122
+ package = setup_package
123
+ open "/de/drugs/feedback/cid/12345"
124
+ assert_equal "CH - ODDB.org | Medikamente | Feedback | Amantadin by Producer | Open Drug Database", get_title
125
+ assert is_text_present('Feedback zu Amantadin by Producer in der Handelsform: 5 Ampullen à 20 ml')
126
+ assert is_element_present('name')
127
+ assert is_element_present('email')
128
+ assert is_element_present('email_public')
129
+ assert is_element_present('message')
130
+ assert is_element_present('item_good_experience')
131
+ assert is_element_present('item_recommended')
132
+ assert is_element_present('item_good_impression')
133
+ assert is_element_present('item_helps')
134
+ ## Captcha temporarily disabled
135
+ # assert is_text_present("Was steht im Bild unten?")
136
+ # assert is_element_present("//input[starts-with(@name, 'captcha')]")
137
+ type "name", "My Name"
138
+ type "email", "my.email@home.com"
139
+ check "//input[@name='email_public'][@value='1']"
140
+ type "message", "My personal experience"
141
+ check "//input[@name='item_good_experience'][@value='0']"
142
+ check "//input[@name='item_recommended'][@value='1']"
143
+ check "//input[@name='item_good_impression'][@value='0']"
144
+ check "//input[@name='item_helps'][@value='1']"
145
+ # type "//input[starts-with(@name, 'captcha')]", "Valid thanks to Flexmock"
146
+ click "//input[@type='submit']"
147
+ wait_for_page_to_load 30
148
+ assert is_text_present("Vielen Dank! Ihr Feedback wurde gespeichert. Sie können jetzt noch Änderungen vornehmen.")
149
+ # assert !is_text_present('Ihre Eingabe stimmt nicht mit dem Bild überein. Bitte versuchen Sie es noch einmal.')
150
+ assert !is_text_present('Bitte geben Sie einen Namen an.')
151
+ assert !is_text_present('Bitte geben Sie eine gültige E-Mail-Adresse an.')
152
+ assert is_element_present('name')
153
+ assert is_element_present('email')
154
+ assert is_element_present('email_public')
155
+ assert is_element_present('message')
156
+ assert is_element_present('item_good_experience')
157
+ assert is_element_present('item_recommended')
158
+ assert is_element_present('item_good_impression')
159
+ assert is_element_present('item_helps')
160
+ # assert !is_element_present("//input[starts-with(@name, 'captcha')]")
161
+ # assert !is_text_present("Was steht im Bild unten?")
162
+ assert is_text_present("Feedback von My Name\nerstellt am:")
163
+ assert is_text_present("My personal experience")
164
+ assert !is_text_present("My personal experience with this Product was ok.")
165
+ type "message", "My personal experience with this Product was ok."
166
+ click "//input[@type='submit']"
167
+ wait_for_page_to_load 30
168
+ assert is_text_present("Vielen Dank! Ihr Feedback wurde geändert. Sie können noch weitere Änderungen vornehmen.")
169
+ assert is_text_present("My personal experience with this Product was ok.")
170
+ assert File.exist?(@path)
171
+ end
172
+ def test_feedback__search
173
+ setup_package
174
+ open "/de/drugs/feedback/cid/12345"
175
+ assert_equal "CH - ODDB.org | Medikamente | Feedback | Amantadin by Producer | Open Drug Database", get_title
176
+ type "query", "Amantadin"
177
+ select "dstype", "Preisvergleich"
178
+ wait_for_page_to_load 30
179
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
180
+ get_title
181
+ end
182
+ def test_feedback__limited
183
+ ODDB.config.query_limit = 1
184
+ package = setup_package
185
+ open "/de/drugs/feedback/cid/12345"
186
+ assert_equal "CH - ODDB.org | Medikamente | Feedback | Amantadin by Producer | Open Drug Database", get_title
187
+ open "/de/drugs/feedback/cid/12345"
188
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
189
+ get_title
190
+ assert is_text_present("Abfragebeschränkung")
191
+ ensure
192
+ ODDB.config.query_limit = 20
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+ # Selenium::TestInit -- de.oddb.org -- 20.02.2007 -- hwyss@ywesee.com
3
+
4
+ $: << File.expand_path('..', File.dirname(__FILE__))
5
+
6
+ require 'selenium/unit'
7
+ require 'stub/model'
8
+ require 'oddb/util'
9
+
10
+ module ODDB
11
+ module Selenium
12
+ class TestInit < Test::Unit::TestCase
13
+ include Selenium::TestCase
14
+ def setup
15
+ f1 = Util::Feedback.new
16
+ i1 = flexmock('package')
17
+ p1 = flexmock('part')
18
+ p1.should_receive(:size).and_return(10)
19
+ u1 = Drugs::Unit.new
20
+ u1.name.de = 'Tabletten'
21
+ p1.should_receive(:unit).and_return(u1)
22
+ p1.should_ignore_missing
23
+ p1.should_receive(:multi).and_return nil
24
+ p1.should_receive(:quantity).and_return nil
25
+ i1.should_receive(:name).and_return('Product')
26
+ i1.should_receive(:parts).and_return [p1]
27
+ i1.should_ignore_missing
28
+ f1.item = i1
29
+ f1.save
30
+ super
31
+ end
32
+ def teardown
33
+ Util::Feedback.instances.clear
34
+ super
35
+ end
36
+ def test_init
37
+ open "/"
38
+ assert_equal "CH - ODDB.org | Medikamente | Home | Open Drug Database", get_title
39
+ assert is_element_present("query")
40
+ assert is_element_present("reset")
41
+ assert is_element_present("//input[@name='search']")
42
+ assert_match Regexp.new(ODDB.config.http_server),
43
+ get_attribute("//form[@name='search']@action")
44
+ assert is_element_present("link=Home")
45
+ assert is_element_present("link=Kontakt")
46
+ assert is_element_present("link=Arzneimittel A-Z")
47
+ assert is_element_present("//a[@name='feedback_feed_title']")
48
+ assert is_text_present("Product in der Handelsform: 10 Tabletten")
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,305 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # Selenium::TestLimit -- de.oddb.org -- 01.02.2008 -- hwyss@ywesee.com
4
+
5
+ $: << File.expand_path('..', File.dirname(__FILE__))
6
+
7
+ require 'selenium/unit'
8
+ require 'odba'
9
+ require 'oddb/drugs'
10
+ require 'oddb/util'
11
+ require 'stub/model'
12
+
13
+ module ODDB
14
+ module Selenium
15
+ class TestLimit < Test::Unit::TestCase
16
+ include Selenium::TestCase
17
+ def setup
18
+ Drugs::Package.instances.clear
19
+ Drugs::Product.instances.clear
20
+ Business::Company.instances.clear
21
+ @cache = flexstub(ODBA.cache)
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_autosession(yus)
31
+ session = flexmock('session')
32
+ yus.should_receive(:autosession).and_return { |domain, block|
33
+ assert_equal 'org.oddb.de', domain
34
+ block.call session
35
+ }
36
+ session
37
+ end
38
+ def setup_package(name="Amantadin by Producer", atccode='N04BB01')
39
+ product = Drugs::Product.new
40
+ company = Business::Company.new
41
+ company.name.de = 'Producer AG'
42
+ product.company = company
43
+ company.save
44
+ sequence = Drugs::Sequence.new
45
+ sequence.product = product
46
+ atc = Drugs::Atc.new(atccode)
47
+ atc.name.de = 'Amantadin'
48
+ ddd = Drugs::Ddd.new('O')
49
+ ddd.dose = Drugs::Dose.new(10, 'mg')
50
+ atc.add_ddd(ddd)
51
+ sequence.atc = atc
52
+ composition = Drugs::Composition.new
53
+ galform = Drugs::GalenicForm.new
54
+ galform.description.de = 'Tabletten'
55
+ composition.galenic_form = galform
56
+ grp = Drugs::GalenicGroup.new('Tabletten')
57
+ grp.administration = 'O'
58
+ galform.group = grp
59
+ sequence.add_composition(composition)
60
+ substance = Drugs::Substance.new
61
+ substance.name.de = 'Amantadin'
62
+ dose = Drugs::Dose.new(100, 'mg')
63
+ active_agent = Drugs::ActiveAgent.new(substance, dose)
64
+ composition.add_active_agent(active_agent)
65
+ package = Drugs::Package.new
66
+ code = Util::Code.new(:cid, '12345', 'CH')
67
+ package.add_code(code)
68
+ code = Util::Code.new(:festbetragsstufe, 3, 'CH')
69
+ package.add_code(code)
70
+ code = Util::Code.new(:festbetragsgruppe, 4, 'CH')
71
+ package.add_code(code)
72
+ code = Util::Code.new(:zuzahlungsbefreit, true, 'CH')
73
+ package.add_code(code)
74
+ part = Drugs::Part.new
75
+ part.package = package
76
+ part.size = 5
77
+ part.composition = composition
78
+ unit = Drugs::Unit.new
79
+ unit.name.de = 'Ampullen'
80
+ part.unit = unit
81
+ part.quantity = Drugs::Dose.new(20, 'ml')
82
+ package.name.de = name
83
+ package.sequence = sequence
84
+ package.add_price(Business::Price.new(:public, 'CH', 6))
85
+ package.add_price(Business::Price.new(:festbetrag, 'CH', 10))
86
+ package.save
87
+ package
88
+ end
89
+ def test_limit
90
+ ODDB.config.query_limit = 1
91
+ package = setup_package
92
+ open "/de/drugs/search/query/Amantadin"
93
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
94
+ get_title
95
+ 2.times {
96
+ open "/de/drugs/search/query/Amantadin"
97
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
98
+ get_title
99
+ assert is_text_present("Abfragebeschränkung")
100
+ }
101
+ ensure
102
+ ODDB.config.query_limit = 20
103
+ end
104
+ def test_limit__login__fail_unknown_user
105
+ ODDB.config.query_limit = 1
106
+ package = setup_package
107
+ open "/de/drugs/search/query/Amantadin"
108
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
109
+ get_title
110
+ open "/de/drugs/search/query/Amantadin"
111
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
112
+ get_title
113
+ assert is_text_present("Abfragebeschränkung")
114
+ @auth.should_receive(:login).and_return { raise Yus::UnknownEntityError }
115
+ type "email", "unknown@bbmb.ch"
116
+ type "pass", "secret"
117
+ click "//input[@name='login_']"
118
+ wait_for_page_to_load 30
119
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
120
+ get_title
121
+ assert_equal "error", get_attribute("//label[@for='email']@class")
122
+ ensure
123
+ ODDB.config.query_limit = 20
124
+ end
125
+ def test_limit__login__fail_wrong_password
126
+ ODDB.config.query_limit = 1
127
+ package = setup_package
128
+ open "/de/drugs/search/query/Amantadin"
129
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
130
+ get_title
131
+ open "/de/drugs/search/query/Amantadin"
132
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
133
+ get_title
134
+ assert is_text_present("Abfragebeschränkung")
135
+ @auth.should_receive(:login).and_return { raise Yus::AuthenticationError }
136
+ type "email", "unknown@bbmb.ch"
137
+ type "pass", "secret"
138
+ click "//input[@name='login_']"
139
+ wait_for_page_to_load 30
140
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
141
+ get_title
142
+ assert_equal "error", get_attribute("//label[@for='pass']@class")
143
+ ensure
144
+ ODDB.config.query_limit = 20
145
+ end
146
+ def test_limit__login
147
+ ODDB.config.query_limit = 1
148
+ package = setup_package
149
+ open "/de/drugs/search/query/Amantadin"
150
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
151
+ get_title
152
+ open "/de/drugs/search/query/Amantadin"
153
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
154
+ get_title
155
+ assert is_text_present("Abfragebeschränkung")
156
+
157
+ email = "poweruser@oddb.org"
158
+ permissions = [
159
+ ['login', 'org.oddb.de.PowerUser'], ['view', 'org.oddb.de']
160
+ ]
161
+ user = mock_user email, *permissions
162
+ @auth.should_receive(:login).and_return(user)
163
+ type "email", email
164
+ type "pass", "sikrit"
165
+ click "//input[@name='login_']"
166
+ wait_for_page_to_load 30
167
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
168
+ get_title
169
+ ensure
170
+ ODDB.config.query_limit = 20
171
+ end
172
+ def test_limit__new_user__error
173
+ ODDB.config.query_limit = 1
174
+ package = setup_package
175
+ open "/de/drugs/search/query/Amantadin"
176
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
177
+ get_title
178
+ open "/de/drugs/search/query/Amantadin"
179
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
180
+ get_title
181
+ assert is_text_present("Abfragebeschränkung")
182
+
183
+ click "//input[@type='submit']"
184
+ wait_for_page_to_load 30
185
+
186
+ assert is_text_present("Bitte wählen Sie eine Zeitdauer")
187
+ ensure
188
+ ODDB.config.query_limit = 20
189
+ end
190
+ def test_limit__new_user
191
+ ODDB.config.query_limit = 1
192
+ package = setup_package
193
+ open "/de/drugs/search/query/Amantadin"
194
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
195
+ get_title
196
+ open "/de/drugs/search/query/Amantadin"
197
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
198
+ get_title
199
+ assert is_text_present("Abfragebeschränkung")
200
+
201
+ click "//input[@name='days']"
202
+ click "//input[@type='submit']"
203
+ wait_for_page_to_load 30
204
+
205
+ assert is_text_present("Power-User Datenerfassung")
206
+ assert is_text_present('Bitte geben Sie Ihre persönlichen Angaben ein und wählen Sie einen Benutzernamen und ein Passwort.')
207
+
208
+ assert_equal "E-Mail", get_text("//label[@for='email']")
209
+ assert is_element_present("email")
210
+ assert_equal "Passwort", get_text("//label[@for='pass']")
211
+ assert is_element_present("pass")
212
+ assert_equal "Bestätigung", get_text("//label[@for='confirm_pass']")
213
+ assert is_element_present("confirm_pass")
214
+ assert_equal "Anrede", get_text("//label[@for='salutation']")
215
+ assert is_element_present("salutation")
216
+ assert_equal "Nachname", get_text("//label[@for='name_last']")
217
+ assert is_element_present("name_last")
218
+ assert_equal "Vorname", get_text("//label[@for='name_first']")
219
+ assert is_element_present("name_first")
220
+
221
+ assert is_text_present("365 x")
222
+ assert is_text_present("unlimited access")
223
+ ensure
224
+ ODDB.config.query_limit = 20
225
+ end
226
+ def test_limit__new_user__step2_error
227
+ ODDB.config.query_limit = 1
228
+ package = setup_package
229
+ open "/de/drugs/search/query/Amantadin"
230
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
231
+ get_title
232
+ open "/de/drugs/search/query/Amantadin"
233
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
234
+ get_title
235
+ assert is_text_present("Abfragebeschränkung")
236
+
237
+ click "//input[@name='days']"
238
+ click "//input[@type='submit']"
239
+ wait_for_page_to_load 30
240
+
241
+ assert is_text_present("Power-User Datenerfassung")
242
+ assert is_text_present('Bitte geben Sie Ihre persönlichen Angaben ein und wählen Sie einen Benutzernamen und ein Passwort.')
243
+
244
+ @auth.should_receive(:login).and_return { raise Yus::UnknownEntityError }
245
+ click "//input[@type='submit']"
246
+ wait_for_page_to_load 30
247
+ assert is_text_present("Bitte füllen Sie alle Felder aus.")
248
+ %w{email pass confirm_pass salutation name_last name_first}.each { |key|
249
+ assert_equal "error", get_attribute("//label[@for='#{key}']@class")
250
+ }
251
+ ensure
252
+ ODDB.config.query_limit = 20
253
+ end
254
+ def test_limit__new_user__step2
255
+ yus = flexmock("yus-server")
256
+ remote = DRb.start_service('druby://localhost:0', yus)
257
+ yus_session = setup_autosession(yus)
258
+ yus_session.should_receive(:get_entity_preferences).and_return({})
259
+ email = "poweruser@oddb.org"
260
+ ODDB.config.auth_server = remote.uri
261
+ ODDB.config.query_limit = 1
262
+ package = setup_package
263
+ open "/de/drugs/search/query/Amantadin"
264
+ assert_equal "CH - ODDB.org | Medikamente | Suchen | Amantadin | Preisvergleich | Open Drug Database",
265
+ get_title
266
+ open "/de/drugs/search/query/Amantadin"
267
+ assert_equal 'CH - ODDB.org | Medikamente | Open Drug Database',
268
+ get_title
269
+ assert is_text_present("Abfragebeschränkung")
270
+
271
+ click "//input[@name='days']"
272
+ click "//input[@type='submit']"
273
+ wait_for_page_to_load 30
274
+
275
+ assert is_text_present("Power-User Datenerfassung")
276
+ assert is_text_present('Bitte geben Sie Ihre persönlichen Angaben ein und wählen Sie einen Benutzernamen und ein Passwort.')
277
+
278
+ @auth.should_receive(:login).and_return { raise Yus::UnknownEntityError }
279
+ type "email", email
280
+ type "pass", "secret"
281
+ type "confirm_pass", "secret"
282
+ select "//select[@name='salutation']", "Herr"
283
+ type "name_last", "Test"
284
+ type "name_first", "Fritz"
285
+
286
+ yus_session.should_receive(:create_entity).with(email, "5ebe2294ecd0e0f08eab7690d2a6ee69")
287
+ permissions = [
288
+ ['login', 'org.oddb.de.PowerUser'], ['view', 'org.oddb.de']
289
+ ]
290
+ user = mock_user email, *permissions
291
+ ODDB.server = server = flexmock("server")
292
+ server.should_receive(:login).and_return(user)
293
+ @auth.should_receive(:login).and_return(user)
294
+
295
+ click "//input[@type='submit']"
296
+ wait_for_page_to_load 30
297
+
298
+ output = @http_server.redirected_output
299
+ assert_match /www.sandbox.paypal.com/, output
300
+ ensure
301
+ ODDB.config.query_limit = 20
302
+ end
303
+ end
304
+ end
305
+ end