testRoutineSimulator.py 1.61 KB
# OBSOLETE FILE

# from django.conf import settings
# from django.test import TestCase
# from common.models import *
# from time import gmtime, strftime
#
# import os
# import sys
# import time
# import datetime
# import logger.config as l
#
#
# """ logger """
# log = l.setupLogger("testRoutine", "testRoutine")
#
# class SimulatorRoutine(TestCase):
#
#     fixtures = ["initial_fixture.json"]
#
#     def setUp(self):
#         pass
#
#     def createRoutine(self, users, requests, quantity, delay):
#         count = 0
#         while (count < quantity):
#             date = str(datetime.datetime.now())
#             req = Request(name="Simulation %d"%count,
#                 desc="Request of routin simulation",
#                 created=date,
#                 updated=date,
#                 is_alert=0,
#                 target_type="test",
#                 status=None,
#                 autodeposit=0,
#                 checkpoint=None,
#                 flag=None,
#                 complete=0,
#                 pyros_user_id=1,
#                 scientific_program_id=1)
#
#     def test_creation(self):
#         # Launching the web server on test database
#         print("Launching Web server on test database (ONLY MYSQL FOR NOW)")
#         os.system("%s/../pyrosrun.sh test_runserver &"%(settings.BASE_DIR))
#         # Waiting for the server to be launched
#         time.sleep(10)
#
#         # Kill the process linked to port defined in test_settings.py
#         print("Killing Web server on port %d"%(settings.TEST_PORT))
#         os.system("fuser -k %d/tcp"%(settings.TEST_PORT))
#         print("Simulation ended")