2222
2323
2424@pytest .mark .smoke
25- class TestCSC (testlib .SDKTestCase ):
26- def test_eventing_app (self ):
27- app_name = "eventing_app"
25+ class TestEventingApp (testlib .SDKTestCase ):
26+ app_name = "eventing_app"
2827
28+ def test_metadata (self ):
2929 self .assertTrue (
30- app_name in self .service .apps , msg = "%s is not installed." % app_name
30+ TestEventingApp .app_name in self .service .apps ,
31+ msg = f"{ TestEventingApp .app_name } is not installed." ,
3132 )
3233
3334 # Fetch the app
34- app = self .service .apps [app_name ]
35+ app = self .service .apps [TestEventingApp . app_name ]
3536 app .refresh ()
3637
3738 # Extract app info
@@ -40,6 +41,8 @@ def test_eventing_app(self):
4041 state = app .state
4142
4243 # App info assertions
44+ self .assertEqual (state .title , TestEventingApp .app_name )
45+
4346 self .assertEqual (access .app , "system" )
4447 self .assertEqual (access .can_change_perms , "1" )
4548 self .assertEqual (access .can_list , "1" )
@@ -61,8 +64,7 @@ def test_eventing_app(self):
6164 self .assertEqual (content .version , "1.0.0" )
6265 self .assertEqual (content .visible , "1" )
6366
64- self .assertEqual (state .title , "eventing_app" )
65-
67+ def test_behavior (self ):
6668 makeresults_count = 20
6769 expected_results_count = 10
6870 expected_status = "200"
@@ -94,15 +96,19 @@ def test_eventing_app(self):
9496 self .assertIn ("status" , res )
9597 self .assertEqual (res ["status" ], expected_status )
9698
97- def test_generating_app (self ):
98- app_name = "generating_app"
9999
100+ @pytest .mark .smoke
101+ class TestGeneratingApp (testlib .SDKTestCase ):
102+ app_name = "generating_app"
103+
104+ def test_metadata (self ):
100105 self .assertTrue (
101- app_name in self .service .apps , msg = "%s is not installed." % app_name
106+ TestGeneratingApp .app_name in self .service .apps ,
107+ msg = f"{ TestGeneratingApp .app_name } is not installed." ,
102108 )
103109
104110 # Fetch the app
105- app = self .service .apps [app_name ]
111+ app = self .service .apps [TestGeneratingApp . app_name ]
106112 app .refresh ()
107113
108114 # Extract app info
@@ -111,6 +117,8 @@ def test_generating_app(self):
111117 state = app .state
112118
113119 # App info assertions
120+ self .assertEqual (state .title , TestGeneratingApp .app_name )
121+
114122 self .assertEqual (access .app , "system" )
115123 self .assertEqual (access .can_change_perms , "1" )
116124 self .assertEqual (access .can_list , "1" )
@@ -134,23 +142,27 @@ def test_generating_app(self):
134142 self .assertEqual (content .version , "1.0.0" )
135143 self .assertEqual (content .visible , "1" )
136144
137- self . assertEqual ( state . title , "generating_app" )
138-
139- jobs = self . service . jobs
140- stream = jobs . oneshot ( "| generatingcsc count=4" , output_mode = "json" )
145+ def test_behavior ( self ):
146+ stream = self . service . jobs . oneshot (
147+ "| generatingcsc count=4" , output_mode = "json"
148+ )
141149 result = results .JSONResultsReader (stream )
142150 ds = list (result )
143151 self .assertTrue (len (ds ) == 4 )
144152
145- def test_reporting_app (self ):
146- app_name = "reporting_app"
147153
154+ @pytest .mark .smoke
155+ class TestReportingApp (testlib .SDKTestCase ):
156+ app_name = "reporting_app"
157+
158+ def test_metadata (self ):
148159 self .assertTrue (
149- app_name in self .service .apps , msg = "%s is not installed." % app_name
160+ TestReportingApp .app_name in self .service .apps ,
161+ msg = f"{ TestReportingApp .app_name } is not installed." ,
150162 )
151163
152164 # Fetch the app
153- app = self .service .apps [app_name ]
165+ app = self .service .apps [TestReportingApp . app_name ]
154166 app .refresh ()
155167
156168 # Extract app info
@@ -159,6 +171,8 @@ def test_reporting_app(self):
159171 state = app .state
160172
161173 # App info assertions
174+ self .assertEqual (state .title , TestReportingApp .app_name )
175+
162176 self .assertEqual (access .app , "system" )
163177 self .assertEqual (access .can_change_perms , "1" )
164178 self .assertEqual (access .can_list , "1" )
@@ -182,11 +196,9 @@ def test_reporting_app(self):
182196 self .assertEqual (content .version , "1.0.0" )
183197 self .assertEqual (content .visible , "1" )
184198
185- self .assertEqual (state .title , "reporting_app" )
186-
199+ def test_behavior_all_entries_above_cutoff (self ):
187200 jobs = self .service .jobs
188201
189- # All above 150
190202 stream = jobs .oneshot (
191203 "| makeresults count=10 | eval math=100, eng=100, cs=100 | reportingcsc cutoff=150 math eng cs" ,
192204 output_mode = "json" ,
@@ -201,8 +213,8 @@ def test_reporting_app(self):
201213 no_of_students = int (list (ds [0 ].values ())[0 ])
202214 self .assertTrue (no_of_students == 10 )
203215
204- # All below 150
205- stream = jobs .oneshot (
216+ def test_behavior_all_entries_below_cutoff ( self ):
217+ stream = self . service . jobs .oneshot (
206218 "| makeresults count=10 | eval math=45, eng=45, cs=45 | reportingcsc cutoff=150 math eng cs" ,
207219 output_mode = "json" ,
208220 )
@@ -216,15 +228,19 @@ def test_reporting_app(self):
216228 no_of_students = int (list (ds [0 ].values ())[0 ])
217229 self .assertTrue (no_of_students == 0 )
218230
219- def test_streaming_app (self ):
220- app_name = "streaming_app"
221231
232+ @pytest .mark .smoke
233+ class TestStreamingApp (testlib .SDKTestCase ):
234+ app_name = "streaming_app"
235+
236+ def test_metadata (self ):
222237 self .assertTrue (
223- app_name in self .service .apps , msg = "%s is not installed." % app_name
238+ TestStreamingApp .app_name in self .service .apps ,
239+ msg = f"{ TestStreamingApp .app_name } is not installed." ,
224240 )
225241
226242 # Fetch the app
227- app = self .service .apps [app_name ]
243+ app = self .service .apps [TestStreamingApp . app_name ]
228244 app .refresh ()
229245
230246 # Extract app info
@@ -233,6 +249,8 @@ def test_streaming_app(self):
233249 state = app .state
234250
235251 # App info assertions
252+ self .assertEqual (state .title , TestStreamingApp .app_name )
253+
236254 self .assertEqual (access .app , "system" )
237255 self .assertEqual (access .can_change_perms , "1" )
238256 self .assertEqual (access .can_list , "1" )
@@ -256,11 +274,8 @@ def test_streaming_app(self):
256274 self .assertEqual (content .version , "1.0.0" )
257275 self .assertEqual (content .visible , "1" )
258276
259- self .assertEqual (state .title , "streaming_app" )
260-
261- jobs = self .service .jobs
262-
263- stream = jobs .oneshot (
277+ def test_behavior (self ):
278+ stream = self .service .jobs .oneshot (
264279 "| makeresults count=5 | eval celsius = 35 | streamingcsc" ,
265280 output_mode = "json" ,
266281 )
0 commit comments