2024-02-27 11:03:11 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
from pyail import PyAIL
|
|
|
|
|
|
|
|
sys.path.append(os.environ['AIL_BIN'])
|
|
|
|
##################################
|
|
|
|
# Import Project packages
|
|
|
|
##################################
|
2024-08-13 14:10:17 +02:00
|
|
|
from lib import ail_users
|
2024-02-27 11:03:11 +01:00
|
|
|
|
2024-08-13 14:10:17 +02:00
|
|
|
from lib.ConfigLoader import ConfigLoader
|
2024-02-27 11:03:11 +01:00
|
|
|
|
|
|
|
class TestApiV1(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
2024-08-13 14:10:17 +02:00
|
|
|
config = ConfigLoader()
|
|
|
|
port = config.get_config_str('Flask', 'port')
|
|
|
|
self.ail = PyAIL(f'https://localhost:{port}', ail_users.get_user_token('admin@admin.test'), ssl=False)
|
2024-02-27 11:03:11 +01:00
|
|
|
|
|
|
|
# GET /api/v1/ping
|
|
|
|
def test_0001_api_ping(self):
|
|
|
|
r = self.ail.ping_ail()
|
|
|
|
self.assertEqual(r.get('status'), 'pong')
|
2024-08-13 14:10:17 +02:00
|
|
|
print()
|
|
|
|
print('----------------------------------------------------')
|
|
|
|
print(' AIL successfully reached Flask / Web interface')
|
|
|
|
print('----------------------------------------------------')
|
|
|
|
print()
|
2024-02-27 11:03:11 +01:00
|
|
|
|
|
|
|
# # GET /api/v1/uuid
|
|
|
|
# def test_0001_api_uuid(self):
|
|
|
|
# r = self.ail.get_uuid()
|
|
|
|
#
|
|
|
|
# # GET /api/v1/version
|
|
|
|
# def test_0001_api_version(self):
|
|
|
|
# r = self.ail.get_version()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main(exit=False)
|