77category = 1
88coursename = "C1"
99tags = "@block @block_evasys_sync @block_evasys_sync_fulltest"
10- lsfcourseid = 0
1110# options
1211OPTIONS = {
1312 "automode" : ["manual" , "auto" ],
1918 "actualstate" : ["open" , "closed" , "mixed" ]
2019}
2120
22- ### GLOBAL VARIABLES ###
23- # Section for non-intuitive global variables
24- # - lsfcourseid:
25- # This variable gets reset to 0 everytime a new scenario is building. Everytime a scenario is added via
26- # declaring a valid idnumber (+1) a single link course (+1) or mutiple linked courses(+2) it gets incremented.
27- # after these parameters have been processed, the text to mock *idnumber* evasyscourses will be added.
28-
2921
3022def get_checks (mode , standardtime , students_state , idnumber_state , mapped_state , internal_state , actual_state ):
3123 """
@@ -77,16 +69,16 @@ def get_checks(mode, standardtime, students_state, idnumber_state, mapped_state,
7769 return checks
7870
7971
80- def get_postcondensing_checks ():
72+ def get_postcondensing_checks (idnumber_state , mapped_state ):
8173 """
8274 :return: checks for a scenario that should NOT be considered in the condense step
8375 """
8476 postchecks = ""
8577 # Check that surveys are actually shown.
8678 # We don't want to include this in the sorting, because it only tests a for loop, but multiplies the tests by 2.
87- global lsfcourseid
88- for i in range ( 0 , lsfcourseid ):
89- postchecks += "And I should see \" Name: Evatestcourse " + str ( i ) + " \" \n "
79+ postchecks += postcheck_idnumber ( idnumber_state )
80+ postchecks += postcheck_mappedstate ( mapped_state )
81+
9082 postchecks = postchecks .replace ("\n " , "\n " )
9183 return postchecks
9284
@@ -140,8 +132,6 @@ def get_scenario(mode, standardtime, students_state, idnumber_state, mapped_stat
140132 This constructs the actual scenario by building all courses, states etc.
141133 :return: string the combined enviroment specifiing string for a scenario
142134 """
143- global lsfcourseid
144- lsfcourseid = 0
145135 behat_scenario = manual_auto_mode [mode ].replace ("{{category}}" , str (category )) + "\n "
146136 behat_scenario += standardtimeMode [standardtime ].replace ("{{category}}" , str (category )) + "\n "
147137 behat_scenario += studentsState [students_state ] + "\n "
@@ -153,7 +143,8 @@ def get_scenario(mode, standardtime, students_state, idnumber_state, mapped_stat
153143 behat_scenario += "And I turn editing mode off\n "
154144 behat_scenario = behat_scenario .replace ("\n " , "\n " )
155145
156- if actual_state == "mixed" and lsfcourseid < 2 :
146+ if actual_state == "mixed" and not ((idnumber_state == "one" and (mapped_state == "multi" or mapped_state == "one" ))
147+ or mapped_state == "multi" ):
157148 # a mixed state is impossible with less than 2 lsfscourseids, so we skip this.
158149 return False
159150 return behat_scenario
@@ -308,7 +299,7 @@ def main():
308299 if not scen_text :
309300 print ("Warning impossible scenario!!!" )
310301 continue
311- postcheck = get_postcondensing_checks ()
302+ postcheck = get_postcondensing_checks (idnumber_state , mapped_state )
312303 output += make_scenario (desc , scen_text , check + postcheck )
313304
314305 output = output .replace ("\n \n " , "\n \n " ) # remove whitespaces on empty lines
0 commit comments