コード例 #1
0
    def test_superuser_authentication(self):
        """
        A test that will run on a clean & empty database, create all migrations, new
        browser session and passes a CSRF token with the POST input request.
        
        Server gets killed at the end of the test.
        """
        url_string = 'aimmo/login'
        delete_old_database()

        os.chdir(runner.ROOT_DIR_LOCATION)
        self.processes = runner.run(use_minikube=False,
                                    server_wait=False,
                                    capture_output=True,
                                    test_env=True)
        client = Client()
        response = client.get(reverse(url_string))
        self.assertEquals(response.status_code, 200)
        csrf_token = response.context['csrf_token']

        login_info = {
            'username': '******',
            'password': '******',
            'csrftoken': csrf_token,
        }

        response = client.post(reverse(url_string), login_info)
        self.assertEquals(response.status_code, 302)
コード例 #2
0
 def setUp(self):
     """
     Sets a clean database for each test before running
     starting starting the run script again. Sleeps 60 second
     between each test to ensure stable state and loads the
     api instance from the kubernetes client.
     """
     delete_old_database()
     self.processes = runner.run(use_minikube=True,
                                 server_wait=False,
                                 capture_output=True)
     time.sleep(120)
     kubernetes.config.load_kube_config(context='minikube')
     self.api_instance = kubernetes.client.CoreV1Api()
     self.api_extension_instance = kubernetes.client.ExtensionsV1beta1Api()
コード例 #3
0
    def test_superuser_authentication(self):
        """
        A test that will run on a clean & empty database, create all migrations, new
        browser session and passes a CSRF token with the POST input request.
        
        Server gets killed at the end of the test.
        """
        url = 'http://localhost:8000/players/accounts/login/'

        delete_old_database()

        os.chdir(runner.ROOT_DIR_LOCATION)
        self.processes = runner.run(use_minikube=False,
                                    server_wait=False,
                                    capture_output=True)

        self.assertTrue(is_server_healthy(url))

        logging.debug("Creating session...")
        session = create_session()

        send_get_request(session, url)

        logging.debug("Obtaining CSRF Token...")
        csrftoken = obtain_csrftoken(session)

        login_info = {
            'username': '******',
            'password': '******',
            'csrfmiddlewaretoken': csrftoken,
        }

        logging.debug("Sending post response...")

        response = send_post_request(session, url, login_info)
        self.assertEquals(response.status_code, 200)
コード例 #4
0
ファイル: run.py プロジェクト: NiallEgan/aimmo
#!/usr/bin/env python
import os
import signal
import sys
import time
import traceback
from aimmo_runner import runner

if __name__ == '__main__':
    try:
        runner.run(use_minikube='--kube' in sys.argv or '-k' in sys.argv)
    except Exception as err:
        traceback.print_exc()
        raise
    finally:
        os.killpg(0, signal.SIGTERM)
        time.sleep(0.9)
        os.killpg(0, signal.SIGKILL)
コード例 #5
0
    action="store_true",
    default=False,
    help=
    "To specify if you want to use your minikube enviroment for AI:MMO, default is basic docker containers.",
)
parser.add_argument(
    "-t",
    "--target",
    dest="build_target",
    choices=["runner", "tester"],
    action="store",
    default="runner",
    help="""Specify the build stage you wish the docker containers to stop at.
                            By default we simply run the project. This can be used to run the tests
                            but it is recommended that you used 'all_tests.py'
                            Options: runner, tester  """,
)

if __name__ == "__main__":
    try:
        args = parser.parse_args()

        runner.run(args.use_minikube, build_target=args.build_target)
    except Exception as err:
        traceback.print_exc()
        raise
    finally:
        os.killpg(0, signal.SIGTERM)
        time.sleep(0.9)
        os.killpg(0, signal.SIGKILL)
コード例 #6
0
#!/usr/bin/env python
import os
import signal
import sys
import time
import traceback
from aimmo_runner import runner

if __name__ == '__main__':
    try:
        runner.run(use_minikube='--kube' in sys.argv or '-k' in sys.argv,
                   use_vagrant='--vagrant' in sys.argv or '-v' in sys.argv)
    except Exception as err:
        traceback.print_exc()
        raise
    finally:
        os.killpg(0, signal.SIGTERM)
        time.sleep(0.9)
        os.killpg(0, signal.SIGKILL)
コード例 #7
0
ファイル: run.py プロジェクト: riaJha97/aimmo
#!/usr/bin/env python
import os
import signal
import sys
import time
import traceback
from aimmo_runner import runner

if __name__ == '__main__':
    try:
        runner.run('--kube' in sys.argv or '-k' in sys.argv)
    except Exception as err:
        traceback.print_exc()
        raise
    finally:
        os.killpg(0, signal.SIGTERM)
        time.sleep(0.9)
        os.killpg(0, signal.SIGKILL)
コード例 #8
0
    action="store",
    default="runner",
    help="""Specify the build stage you wish the docker containers to stop at.
                            By default we simply run the project. This can be used to run the tests
                            but it is recommended that you used 'all_tests.py'
                            Options: runner, tester  """,
)
parser.add_argument(
    "-c",
    "--using-cypress",
    dest="using_cypress",
    action="store_true",
    default=False,
    help="""Specify if you want to run the project for running Cypress tests. This
    disables the building of the Docker images and builds the frontend in production 
    mode without watching for changes.""",
)

if __name__ == "__main__":
    try:
        args = parser.parse_args()

        runner.run(
            args.use_minikube,
            using_cypress=args.using_cypress,
            build_target=args.build_target,
        )
    except Exception as err:
        traceback.print_exc()
        raise
コード例 #9
0
    action="store",
    default="runner",
    help="""Specify the build stage you wish the docker containers to stop at.
                            By default we simply run the project. This can be used to run the tests
                            but it is recommended that you used 'all_tests.py'
                            Options: runner, tester  """,
)
parser.add_argument(
    "-c",
    "--using-cypress",
    dest="using_cypress",
    action="store_true",
    default=False,
    help=
    """Specify if you want to run the project for running Cypress tests. This
    disables the building of the Docker images and builds the frontend in production 
    mode without watching for changes.""",
)

if __name__ == "__main__":
    try:
        args = parser.parse_args()

        runner.run(
            using_cypress=args.using_cypress,
            build_target=args.build_target,
        )
    except Exception as err:
        traceback.print_exc()
        raise