|
116 | 116 | "none": "" |
117 | 117 | } |
118 | 118 |
|
119 | | -# The following Methods create Gherkin-tables to be used by the behat-functions of the Evasys-Plugin. |
120 | | -# Most of the tables specify a connection or entity per line. |
121 | | - |
122 | | -# relations. |
123 | | -def evasys_relations(shortname, idnumber, semestertxt, veranstnr): |
124 | | - """ |
125 | | - Specifies a Moodlecourse - Evasyscourse connection and creates the necessary lsf-course in the Process. |
126 | | - One connection per table row |
127 | | - :param shortname: Shortname of the moodle-course |
128 | | - :param idnumber: idnumber to use in moodle-course and lsf-identifier |
129 | | - :param semestertxt: semestertxt to use in lsf-course and evasys-identifier |
130 | | - :param veranstnr: veranstnr to use in lsf-course and evasys-identifier |
131 | | - :return: string A behat-table that specifies a full connection from a learnweb-course to a evasys-course |
132 | | - Format: | Shortname | idnumber | semestertxt | veranstnr | |
133 | | - """ |
134 | | - x = "And The following Evasys relations exist:\n" \ |
135 | | - " | shortname | idnumber | semestertxt | veranstnr |\n" |
136 | | - for i in range(0, len(shortname)): |
137 | | - x += " | " + shortname[i] + " | " + idnumber[i] + " | " + semestertxt[i] + " | " + veranstnr[i] + " |\n" |
138 | | - return x |
139 | | - |
140 | | - |
141 | | -def lsf_evasys_surveys(courseshortname, lsfcourses, semsestertxt, veranstnr): |
142 | | - """ |
143 | | - Specifies which evasys-courses should be mapped to a specific moodle-course and creates the necessary lsf-courses. |
144 | | - One evasys-course per row BUT all these will be mapped to a single moodle-course. |
145 | | - :param courseshortname: Shortname of the moodle course |
146 | | - :param lsfcourses: lsfcourseid's to map (what would be the idnumber) |
147 | | - :param semsestertxt: semestertxt of the created lsfcourse and evasys-id |
148 | | - :param veranstnr: veranstnr of lsfcourse and evasys-id |
149 | | - :return: string a behat tablt that specifies which lsf-courses were mapped to a single moodle-course |
150 | | - Format: | lsfcourse | semestertxt | veranstnr | |
151 | | - """ |
152 | | - x = "And the course with shortname " + str(courseshortname) + " has the following lsfcourses mapped:\n" \ |
153 | | - " | lsfcourse | semestertxt | veranstnr |\n" |
154 | | - for i in range(0, len(lsfcourses)): |
155 | | - x += " | " + lsfcourses[i] + " | " + semsestertxt[i] + " | " + veranstnr[i] + " |\n" |
156 | | - return x |
157 | | - |
158 | | - |
159 | | -# entitys |
160 | | -def evasys_courses(evasysid, title, studentcount): |
161 | | - """ |
162 | | - Specifies which evasys-courses should exist. |
163 | | - One evasys-course per line. |
164 | | - :param evasysid: Evasysid |
165 | | - :param title: Title of evasys-course |
166 | | - :param studentcount: number of students synced to the evasys-course |
167 | | - :return: string A behat table that specifies multiple evasys-courses |
168 | | - Format: | Evasysid | Title | Studentcount | |
169 | | - """ |
170 | | - x = "And The following evasys courses exist:\n" \ |
171 | | - " | evasysid | title | studentcount |\n" |
172 | | - for i in range(0, len(evasysid)): |
173 | | - x += " | " + evasysid[i] + " | " + title[i] + " | " + studentcount[i] + " |\n" |
174 | | - return x |
175 | | - |
176 | | - |
177 | | -def evasys_forms(formid): |
178 | | - """ |
179 | | - Specifies which evasys-forms should exist. |
180 | | - One form per row. |
181 | | - :param formid: Formid of the evasys-form |
182 | | - :return: string a behat table that specifies multiple evasysforms |
183 | | - Format: | Id | Name | Title | |
184 | | - """ |
185 | | - x = "And The following Forms exist:\n" \ |
186 | | - " | id | name | title |\n" |
187 | | - for i in range(0, len(formid)): |
188 | | - x += " | " + str(formid[i]) + " | " + "AAAA" + str(formid[i]) + " | " + "Testformnr. " + str( |
189 | | - formid[i]) + " |\n" |
190 | | - return x |
191 | | - |
192 | | - |
193 | | -def evasys_surveys(evasys_course, title, formid, open, completed=-1): |
194 | | - """ |
195 | | - Specifies what evasys-surveys should exist. The referenced evasys-course has to exist. |
196 | | - One survey per row. |
197 | | - :param evasys_course: referenced evasys-course |
198 | | - :param title: Title of the survey |
199 | | - :param formid: Formid of the survey |
200 | | - :param open: wether the survey is open |
201 | | - :param completed: number of students that completed the survey |
202 | | - :return: string a behat-table that specifies multiple evasys-surveys |
203 | | - Format: | course | title | formid | open | completed | |
204 | | - """ |
205 | | - x = "And The following surveys exist:\n" \ |
206 | | - " | course | title | formid | open | completed |\n" |
207 | | - for i in range(0, len(evasys_course)): |
208 | | - if not isinstance(completed, list): |
209 | | - x += " | " + str(evasys_course[i]) + " | " + str(title[i]) + " | " + str(formid[i]) + " | " + str( |
210 | | - open[i]) + " | " + str(random.randrange(200) + 1) + " |\n" |
211 | | - else: |
212 | | - x += " | " + str(evasys_course[i]) + " | " + str(title[i]) + " | " + str(formid[i]) + " | " + str( |
213 | | - open[i]) + " | " + str(completed[i]) + " |\n" |
214 | | - return x |
215 | | - |
216 | 119 |
|
217 | 120 | # The following Methods help to construct Behat steps. |
218 | 121 | # There are only methods when using a dict (like above) is either unnecessarry complicated |
@@ -254,44 +157,6 @@ def mappedState(state, openstate): |
254 | 157 | return x |
255 | 158 |
|
256 | 159 |
|
257 | | -def makeEvasysSurveys(state): |
258 | | - """ |
259 | | - creates the necessary data for the evasys_surveys function given a state, and returns the result for these |
260 | | - :param state: State of the surveys (open/closed/mixed) |
261 | | - :return: String creating surveys of the specified state |
262 | | - """ |
263 | | - global lsfcourseid |
264 | | - if state == "mixed" and lsfcourseid < 2: |
265 | | - return "" |
266 | | - coursenames = [] * lsfcourseid |
267 | | - titles = [] * lsfcourseid |
268 | | - for i in range(0, lsfcourseid): |
269 | | - coursenames.append(str(i) + " WS 2018/19 ") |
270 | | - titles.append("Survey " + str(i)) |
271 | | - if state == "open": |
272 | | - status = [1] * lsfcourseid |
273 | | - elif state == "closed": |
274 | | - status = [0] * lsfcourseid |
275 | | - else: |
276 | | - status = [0, 1] + [0] * lsfcourseid |
277 | | - return evasys_surveys(coursenames, titles, [1] * lsfcourseid, status) |
278 | | - |
279 | | - |
280 | | -def makeEvasysCourses(): |
281 | | - """ |
282 | | - creates the necessary data for <lsfcourseid> many evasys-courses and returns this as a table of evasys-courses |
283 | | - :return: string table that creates evasys-courses |
284 | | - """ |
285 | | - global lsfcourseid |
286 | | - if lsfcourseid < 1: |
287 | | - return "" |
288 | | - x = "And the following evasys courses exist:\n" |
289 | | - x += " | evasysid | title | studentcount |\n" |
290 | | - for i in range(0, lsfcourseid): |
291 | | - x += " | " + str(i) + " WS 2018/19 | Evatestcourse " + str(i) + " | 200 |\n" |
292 | | - return x |
293 | | - |
294 | | - |
295 | 160 | def checks_standardtimemode(standardtime, auto_mode, internal_state, actual_state): |
296 | 161 | """ |
297 | 162 | The standardtimemode check is a little tricky since the checkbox showing is dependent on 3 states |
|
0 commit comments