@@ -131,6 +131,7 @@ def test_invalid_checksum(self):
131
131
class EDIDTextUploadTestCase (TestCase ):
132
132
def setUp (self ):
133
133
Manufacturer .objects .bulk_create ([
134
+ Manufacturer (name_id = 'DEL' , name = 'Dell Inc.' ),
134
135
Manufacturer (name_id = 'SEC' , name = 'Seiko Epson Corporation' ),
135
136
Manufacturer (name_id = 'UNK' , name = 'Unknown' ),
136
137
])
@@ -241,6 +242,41 @@ def test_xrandr(self):
241
242
self .assertEqual (response .context_data ['failed' ], 1 )
242
243
self .assertEqual (response .context_data ['duplicate' ], 0 )
243
244
245
+ def test_xorglog (self ):
246
+ xorglog_text = self ._read_from_file ('xorg.log' )
247
+
248
+ # Submit Xorg.log output
249
+ response = self .client .post (
250
+ self .post_url , {'text' : xorglog_text , 'text_type' : 'xorglog' }
251
+ )
252
+
253
+ # Check an EDID was parsed and added
254
+ self .assertEqual (response .context_data ['succeeded' ], 2 )
255
+ self .assertEqual (response .context_data ['failed' ], 0 )
256
+ self .assertEqual (response .context_data ['duplicate' ], 0 )
257
+
258
+ # Check some of EDID values
259
+ edid = EDID .objects .get (pk = 1 )
260
+ self .assertEqual (
261
+ len ([timing for timing in edid .get_est_timings ()
262
+ if timing ['supported' ]]),
263
+ 8
264
+ )
265
+ self .assertEqual (edid .manufacturer .name_id , 'DEL' )
266
+ self .assertEqual (edid .bdp_video_input , EDID .bdp_video_input_digital )
267
+ self .assertEqual (edid .monitor_range_limits , True )
268
+
269
+ # Duplicate test
270
+ # Submit Xorg.log output again
271
+ response = self .client .post (
272
+ self .post_url , {'text' : xorglog_text , 'text_type' : 'xorglog' }
273
+ )
274
+
275
+ # Check an EDID was parsed and rejected for duplicate
276
+ self .assertEqual (response .context_data ['succeeded' ], 0 )
277
+ self .assertEqual (response .context_data ['failed' ], 0 )
278
+ self .assertEqual (response .context_data ['duplicate' ], 2 )
279
+
244
280
245
281
class EDIDTestCase (EDIDTestMixin , TestCase ):
246
282
def test_list (self ):
@@ -983,6 +1019,7 @@ def test_duplicate(self):
983
1019
class APITextUploadTestCase (TestCase ):
984
1020
def setUp (self ):
985
1021
Manufacturer .objects .bulk_create ([
1022
+ Manufacturer (name_id = 'DEL' , name = 'Dell Inc.' ),
986
1023
Manufacturer (name_id = 'SEC' , name = 'Seiko Epson Corporation' ),
987
1024
Manufacturer (name_id = 'UNK' , name = 'Unknown' ),
988
1025
])
@@ -1099,6 +1136,43 @@ def test_xrandr(self):
1099
1136
self .assertEqual (data ['failed' ], 1 )
1100
1137
self .assertEqual (data ['duplicate' ], 0 )
1101
1138
1139
+ def test_xorglog (self ):
1140
+ xorglog_text = self ._read_from_file ('xorg.log' )
1141
+
1142
+ # Submit Xorglog output
1143
+ response = self .client .post (
1144
+ self .post_url , {'text' : xorglog_text , 'text_type' : 'xorglog' }
1145
+ )
1146
+ data = json .loads (response .content )
1147
+
1148
+ # Check an EDID was parsed and added
1149
+ self .assertEqual (data ['succeeded' ], 2 )
1150
+ self .assertEqual (data ['failed' ], 0 )
1151
+ self .assertEqual (data ['duplicate' ], 0 )
1152
+
1153
+ # Check some of EDID values
1154
+ edid = EDID .objects .get (pk = 1 )
1155
+ self .assertEqual (
1156
+ len ([timing for timing in edid .get_est_timings ()
1157
+ if timing ['supported' ]]),
1158
+ 8
1159
+ )
1160
+ self .assertEqual (edid .manufacturer .name_id , 'DEL' )
1161
+ self .assertEqual (edid .bdp_video_input , EDID .bdp_video_input_digital )
1162
+ self .assertEqual (edid .monitor_range_limits , True )
1163
+
1164
+ # Duplicate test
1165
+ # Submit Xorglog output again
1166
+ response = self .client .post (
1167
+ self .post_url , {'text' : xorglog_text , 'text_type' : 'xorglog' }
1168
+ )
1169
+ data = json .loads (response .content )
1170
+
1171
+ # Check an EDID was parsed and rejected for duplicate
1172
+ self .assertEqual (data ['succeeded' ], 0 )
1173
+ self .assertEqual (data ['failed' ], 0 )
1174
+ self .assertEqual (data ['duplicate' ], 2 )
1175
+
1102
1176
def test_invalid (self ):
1103
1177
response = self .client .post (
1104
1178
self .post_url , {'text' : 'BAD TEXT' , 'text_type' : 'None' }
0 commit comments