Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""Various concrete values needed in the tests.""" 

2 

3from control.utils import EURO 

4from conftest import USERS, NAMED_USERS, POWER_USERS 

5 

6_ID = "_id" 

7DB = "dariah_test" 

8 

9STATIC = "/static" 

10FAV = "/favicons" 

11COMMON_CSS = f"{STATIC}/css/common.css" 

12COMMONX_CSS = f"{STATIC}/css/commonx.css" 

13FAVICON = f"{FAV}/favicon.ico" 

14FAVICONX = f"{FAV}/faviconx.ico" 

15FAVICON_S = f"{STATIC}{FAV}/favicon.ico" 

16FAVICON_SX = f"{STATIC}{FAV}/faviconx.ico" 

17 

18WELCOME = "Welcome to the DARIAH contribution tool" 

19OVERVIEW = "Country selection" 

20 

21ASSESS = "assessment" 

22CONTRIB = "contrib" 

23CRITERIA = "criteria" 

24CRITERIA_ENTRY = "criteriaEntry" 

25COMMENTS = "comments" 

26CONTACT_PERSON_NAME = "contactPersonName" 

27CONTACT_PERSON_EMAIL = "contactPersonEmail" 

28COST_BARE = "costBare" 

29COST_TOTAL = "costTotal" 

30COST_DESCRIPTION = "costDescription" 

31COUNTRY = "country" 

32DATE_DECIDED = "dateDecided" 

33DATE_SUBMITTED = "dateSubmitted" 

34DESCRIPTION = "description" 

35DISCIPLINE = "discipline" 

36EDITORS = "editors" 

37EMAIL = "email" 

38EVIDENCE = "evidence" 

39KEYWORD = "keyword" 

40LEVEL = "level" 

41PACKAGE = "package" 

42REMARKS = "remarks" 

43REP = "rep" 

44REVIEW = "review" 

45REVIEW_ENTRY = "reviewEntry" 

46REVIEWER_E = "reviewerE" 

47REVIEWER_F = "reviewerF" 

48SCORE = "score" 

49TADIRAH_ACTIVITY = "tadirahActivity" 

50TADIRAH_OBJECT = "tadirahObject" 

51TADIRAH_TECHNIQUE = "tadirahTechnique" 

52TITLE = "title" 

53TYPE = "typeContribution" 

54TYPEA = "assessmentType" 

55USER = "user" 

56VCC = "vcc" 

57WORKFLOW = "workflow" 

58YEAR = "year" 

59 

60AUTH = "auth" 

61AUTH_EMAIL = "auth@test.eu" 

62COORD = "coord" 

63OFFICE = "office" 

64OWNER = "owner" 

65OWNER_EMAIL = "owner@test.eu" 

66OWNER_NAME = "Owner of Contribution" 

67EDITOR = "editor" 

68EXPERT = "expert" 

69FINAL = "final" 

70MYCOORD = "mycoord" 

71PUBLIC = "public" 

72ROOT = "root" 

73SYSTEM = "system" 

74 

75INCOMPLETE = "incomplete" 

76INCOMPLETE_REVISED = "incompleteRevised" 

77COMPLETE = "complete" 

78COMPLETE_REVISED = "completeRevised" 

79COMPLETE_WITHDRAWN = "completeWithdrawn" 

80SUBMITTED = "submitted" 

81 

82ACCEPT = "Accept" 

83REJECT = "Reject" 

84REVISE = "Revise" 

85REVOKE = "Revoke" 

86 

87SELECT_ACCEPT = "selectContrib" 

88SELECT_REJECT = "deselectContrib" 

89SELECT_REVOKE = "unselectContrib" 

90START_ASSESSMENT = "startAssessment" 

91START_REVIEW = "startReview" 

92SUBMIT_ASSESSMENT = "submitAssessment" 

93SUBMIT_REVISED = "submitRevised" 

94WITHDRAW_ASSESSMENT = "withdrawAssessment" 

95RESUBMIT_ASSESSMENT = "resubmitAssessment" 

96REVIEW_DECISION = { 

97 ACCEPT: { 

98 EXPERT: "expertReviewAccept", 

99 FINAL: "finalReviewAccept", 

100 }, 

101 REJECT: { 

102 EXPERT: "expertReviewReject", 

103 FINAL: "finalReviewReject", 

104 }, 

105 REVISE: { 

106 EXPERT: "expertReviewRevise", 

107 FINAL: "finalReviewRevise", 

108 }, 

109 REVOKE: { 

110 EXPERT: "expertReviewRevoke", 

111 FINAL: "finalReviewRevoke", 

112 }, 

113} 

114 

115DUMMY_ID = "00000000ffa4bbd9fe000f15" 

116 

117UNDEF_VALUE = "○" 

118 

119TITLE1 = "No Title Yet" 

120TITLE2 = "Contribution (Modified)" 

121TITLE_A = "assessment of {cTitle}" 

122TITLE_A2 = "My contribution assessed" 

123 

124REMARKS_E = "expert remarks" 

125REMARKS_F = "final remarks" 

126 

127EVIDENCE1 = "modified evidence" 

128COMMENTS_E = "modified expert comment" 

129COMMENTS_F = "modified final comment" 

130 

131CHECKS = { 

132 DESCRIPTION: ( 

133 "<h1>Data hosting.</h1>", 

134 "<p>This tool", 

135 "<li>How, we", 

136 "<li>More details", 

137 ), 

138 COST_DESCRIPTION: ( 

139 "<h1>Cost of data hosting.</h1>", 

140 "<p>There are", 

141 "<li>The amount,", 

142 "<li>More cost details", 

143 ), 

144} 

145 

146ELLIPS_DIV = "<div>...</div>" 

147 

148VCC1 = "vcc1" 

149VCC2 = "vcc2" 

150VCC12 = "vcc1,vcc2" 

151URL_C = "urlContribution" 

152URL_A = "urlAcademic" 

153 

154CAPTIONS = ( 

155 ("Home", USERS, None, WELCOME, None), 

156 ("Overview", USERS, None, OVERVIEW, None), 

157 ("All contributions", USERS, 0, "contribution", "contributions"), 

158 ("My contributions", NAMED_USERS, 0, "contribution", "contributions"), 

159 ("{country} contributions", NAMED_USERS, 0, "contribution", "contributions"), 

160 ("Contributions I am assessing", NAMED_USERS, 0, "contribution", "contributions"), 

161 ( 

162 "Contributions to be selected", 

163 {COORD, MYCOORD}, 

164 0, 

165 "contribution", 

166 "contributions", 

167 ), 

168 ("All assessments", POWER_USERS, 0, "assessment", "assessments"), 

169 ("My assessments", NAMED_USERS, 0, "assessment", "assessments"), 

170 ("Assessments needing reviewers", {OFFICE}, 0, "assessment", "assessments"), 

171 ("Assessments in review by me", NAMED_USERS, 0, "assessment", "assessments"), 

172 ("Assessments reviewed by me", NAMED_USERS, 0, "assessment", "assessments"), 

173 ("All reviews", POWER_USERS, 0, "review", "reviews"), 

174 ("My reviews", NAMED_USERS, 0, "review", "reviews"), 

175 ("countries", POWER_USERS, 51, COUNTRY, None), 

176 ("criteria", POWER_USERS, 7, "criteria", None), 

177 ("disciplines", POWER_USERS, 3, None, None), 

178 ("keywords", POWER_USERS, 2, None, None), 

179 ("packages", POWER_USERS, 2, None, None), 

180 ("score levels", POWER_USERS, 20, None, None), 

181 ("TADIRAH Activities", POWER_USERS, 2, "TADIRAH Activity", None), 

182 ("TADIRAH Objects", POWER_USERS, 3, None, None), 

183 ("TADIRAH Techniques", POWER_USERS, 4, None, None), 

184 ("contribution types", POWER_USERS, 5, None, None), 

185 ("users", POWER_USERS, 11, None, None), 

186 ("vccs", POWER_USERS, 2, None, None), 

187 ("years", POWER_USERS, 20, None, None), 

188 ("decisions", {SYSTEM, ROOT}, 3, None, None), 

189 ("value caches", {SYSTEM, ROOT}, None, None, None), 

190 ("permission groups", {SYSTEM, ROOT}, 9, None, None), 

191 ("Refresh the cache", {SYSTEM, ROOT}, None, WELCOME, None), 

192 ("Recompute workflow table", {SYSTEM, ROOT}, None, WELCOME, None), 

193) 

194"""Sidebar entries. 

195 

196With the information which users can see that entry, 

197and, if they click on it, how many items they encounter if run in a clean slate 

198database. 

199 

200The test functions may fill in other amounts when testing in situations where 

201additional records have been created. 

202""" 

203 

204REVIEW_CAPTION = CAPTIONS[10] 

205 

206 

207BELGIUM = "BE🇧🇪" 

208LUXEMBURG = "LU🇱🇺" 

209GERMANY = "DE🇩🇪" 

210FRANCE = "FR🇫🇷" 

211ITALY = "IT🇮🇹" 

212IRELAND = "IE🇮🇪" 

213PORTUGAL = "PT🇵🇹" 

214POLAND = "PL🇵🇱" 

215NETHERLANDS = "NL🇳🇱" 

216 

217USER_COUNTRY = { 

218 PUBLIC: None, 

219 AUTH: GERMANY, 

220 OWNER: BELGIUM, 

221 EDITOR: IRELAND, 

222 MYCOORD: BELGIUM, 

223 COORD: LUXEMBURG, 

224 EXPERT: FRANCE, 

225 FINAL: ITALY, 

226 OFFICE: PORTUGAL, 

227 SYSTEM: POLAND, 

228 ROOT: NETHERLANDS, 

229} 

230"""Where the test users come from.""" 

231 

232CRITERIA_ENTRIES_N = { 

233 "service - data hosting": 2, 

234 "service - processing service": 2, 

235 "activity - resource creation": 4, 

236 "activity - software development": 3, 

237 "legacy - infrastructure": 1, 

238} 

239 

240EXAMPLE = { 

241 DESCRIPTION: [ 

242 """ 

243# Data hosting. 

244 

245This tool hosts data. 

246 

247* How, we don't know yet 

248* More details will follow. 

249""" 

250 ], 

251 COST_BARE: "103.456", 

252 COST_TOTAL: f"{EURO} 103.456", 

253 COST_DESCRIPTION: [ 

254 """ 

255# Cost of data hosting. 

256 

257There are costs. 

258 

259* The amount, we don't know yet 

260* More cost details will follow. 

261""" 

262 ], 

263 YEAR: tuple(str(yr) for yr in range(2010, 2030)), 

264 COUNTRY: f""" 

265AT🇦🇹 

266{BELGIUM} 

267HR🇭🇷 

268CY🇨🇾 

269DK🇩🇰 

270{FRANCE} 

271{GERMANY} 

272GR🇬🇷 

273{IRELAND} 

274{ITALY} 

275{LUXEMBURG} 

276MT🇲🇹 

277{NETHERLANDS} 

278{PORTUGAL} 

279RS🇷🇸 

280SI🇸🇮 

281{POLAND} 

282""".strip().split( 

283 "\n" 

284 ), 

285 VCC: """ 

286vcc1 

287vcc2 

288""".strip().split( 

289 "\n" 

290 ), 

291 TYPE: """ 

292service - data hosting 

293service - processing service 

294activity - resource creation 

295activity - software development 

296legacy - infrastructure 

297""".strip().split( 

298 "\n" 

299 ), 

300 TADIRAH_OBJECT: """ 

301object1 

302object2 

303object3 

304""".strip().split( 

305 "\n" 

306 ), 

307 TADIRAH_ACTIVITY: """ 

308activity1 

309activity2 

310""".strip().split( 

311 "\n" 

312 ), 

313 TADIRAH_TECHNIQUE: """ 

314technique1 

315technique2 

316technique3 

317technique4 

318""".strip().split( 

319 "\n" 

320 ), 

321 DISCIPLINE: """ 

322alpha 

323beta 

324gamma 

325""".strip().split( 

326 "\n" 

327 ), 

328 KEYWORD: """ 

329static 

330dynamic 

331""".strip().split( 

332 "\n" 

333 ), 

334} 

335"""Lots of values in several fields of a contribution.""" 

336 

337TYPE1 = EXAMPLE[TYPE][0] 

338TYPE2 = EXAMPLE[TYPE][3]