@@ -301,8 +301,6 @@ def create_scan(
301301 Returns -> None
302302 """
303303
304- print (f'page_id for scanning -> { page_id } ' )
305-
306304 # get scan if scan_id present
307305 if scan_id is not None :
308306 created_scan = Scan .objects .get (id = scan_id )
@@ -379,7 +377,6 @@ def create_scan_bg(self, *args, **kwargs) -> None:
379377 pages .append (
380378 Page .objects .get (id = item ['id' ])
381379 )
382- print (f'pages added -> { pages } ' )
383380 except Exception as e :
384381 print (e )
385382
@@ -389,7 +386,6 @@ def create_scan_bg(self, *args, **kwargs) -> None:
389386 sites .append (
390387 Site .objects .get (id = item ['id' ])
391388 )
392- print (f'sites added -> { sites } ' )
393389 except Exception as e :
394390 print (e )
395391
@@ -404,12 +400,10 @@ def create_scan_bg(self, *args, **kwargs) -> None:
404400
405401 # creating scans for each page
406402 for page in pages :
407- print ( f'trying to scan page -> { page . page_url } ' )
403+
408404 # check resource
409405 if check_and_increment_resource (page .account , 'scans' ):
410406
411- print (f'allowed to create new Scan' )
412-
413407 # updating latest_scan info for page
414408 page .info ['latest_scan' ]['id' ] = 'placeholder'
415409 page .info ['latest_scan' ]['time_created' ] = str (timezone .now ())
@@ -418,26 +412,20 @@ def create_scan_bg(self, *args, **kwargs) -> None:
418412 page .info ['latest_scan' ]['score' ] = None
419413 page .save ()
420414
421- print ('updated page info' )
422-
423415 # updating latest_scan info for site
424416 page .site .info ['latest_scan' ]['id' ] = 'placeholder'
425417 page .site .info ['latest_scan' ]['time_created' ] = str (timezone .now ())
426418 page .site .info ['latest_scan' ]['time_completed' ] = None
427419 page .site .save ()
428420
429- print ('updated site info' )
430-
431-
421+ # init scan in bg
432422 create_scan .delay (
433423 page_id = str (page .id ),
434424 type = type ,
435425 configs = configs ,
436426 tags = tags ,
437427 automation_id = automation_id
438428 )
439-
440- print ('init new bg scan' )
441429
442430 # update schedule if task_id is not None
443431 if task_id :
@@ -609,8 +597,6 @@ def create_test(
609597 Returns -> None
610598 """
611599
612- print (f'page_id for testing -> { page_id } ' )
613-
614600 # setting defaults
615601 created_test = None
616602
@@ -1411,22 +1397,25 @@ def create_testcase_bg(*args, **kwargs) -> None:
14111397
14121398 # iterate through sites
14131399 for site in sites :
1400+
1401+ # check and increment resource
1402+ if check_and_increment_resource (site .account , 'testcase' ):
14141403
1415- # create new testcase
1416- _testcase = Testcase .objects .create (
1417- case = case ,
1418- case_name = case .name ,
1419- site = site ,
1420- user = site .user ,
1421- account = site .account ,
1422- configs = configs ,
1423- steps = steps
1424- )
1404+ # create new testcase
1405+ _testcase = Testcase .objects .create (
1406+ case = case ,
1407+ case_name = case .name ,
1408+ site = site ,
1409+ user = site .user ,
1410+ account = site .account ,
1411+ configs = configs ,
1412+ steps = steps
1413+ )
14251414
1426- # add to list
1427- testcases .append (
1428- _testcase
1429- )
1415+ # add to list
1416+ testcases .append (
1417+ _testcase
1418+ )
14301419
14311420 # iterate through testcases and run
14321421 for testcase in testcases :
0 commit comments