Commit 5bb0638f authored by Daniele Venzano's avatar Daniele Venzano

Fix pylint and doc8 errors that block the CI pipeline

parent 688b920d
Deploying the Angular FrontEnd
==========================
==============================
Overview
-----------
--------
* The zoe angular frontend can be found in the ``zoe_fe`` folder.
Installation
......@@ -10,16 +10,19 @@ Installation
Installation can be done in two different ways. Both require installation of a few packages, which are listed in ``package.json``. All dependencies can be installed simply by running ``npm install`` from within the ``zoe_fe`` folder.
1. Development Server
* The first way to install the frontend is to install a local development server; this server will automatically reload when source files are changed. This can be done by the following two steps:
* Run ``ng serve``
* Navigate to ``http://localhost:4200/
* Navigate to ``http://localhost:4200/``
2. Proxy Server
* The second way to install zoe can be done using a proxy with zoe. Information for setting up a proxy for zoe can be found at ``docs/proxy.rst``. Once a proxy is created, installation is done by the following:
* Run ``ng build -prod --output-path=prod``
* This will create all the build files in the ``/prod`` directory. These files need to be copied to the frontend server setup in the proxy configuration.
* Note that in order to change the ``<base href="/">`` within the ``index.html`` file, it is possible to add the following to the ``ng build`` command: ``--base-href x`` where x is the new href value.
* This will create all the build files in the ``/prod`` directory. These files need to be copied to the frontend server setup in the proxy configuration.
* Note that in order to change the ``<base href="/">`` within the ``index.html`` file, it is possible to add the following to the ``ng build`` command: ``--base-href x`` where x is the new href value.
Read more
-----------
More information for deploying the angular project can be found in its documentation at ``zoe_fe/README.md``.
\ No newline at end of file
---------
More information for deploying the angular project can be found in its documentation at ``zoe_fe/README.md``.
......@@ -23,30 +23,49 @@ from unittest.mock import patch, MagicMock
from zoe_lib import applications
from zoe_lib import version
class TestApplicationsMethods(unittest.TestCase):
appValidateData = {}
portCheckData = {}
"""Application validation tests."""
app_validate_data = {}
port_check_data = {}
def setUp(self):
currentVersion = version.ZOE_APPLICATION_FORMAT_VERSION
self.appValidateData = { "name": "test name", "will_end": True, "priority": 3, "requires_binary": False, "version": currentVersion, "services": {} }
self.portCheckData = { "name": "test name", "protocol": "http", "port_number": 3, "is_main_endpoint": True }
"""Set up tests."""
current_version = version.ZOE_APPLICATION_FORMAT_VERSION
self.app_validate_data = {
"name": "test name",
"will_end": True,
"priority": 3,
"requires_binary": False,
"version": current_version,
"services": []
}
self.port_check_data = {
"name": "test name",
"protocol": "http",
"port_number": 3,
"is_main_endpoint": True
}
def test_port_check_works_with_valid_port(self):
def test_pass_for_valid_port(self):
"""Test port validation code."""
try:
applications._port_check(self.portCheckData)
applications._port_check(self.port_check_data) # pylint: disable=protected-access
except Exception:
self.fail("_port_check threw an exception for valid data")
def test_port_check_fails_for_invalid_port_number(self):
self.portCheckData["port_number"] = "not_a_number"
self.assertRaises(applications.InvalidApplicationDescription, applications._port_check, self.portCheckData)
def test_fails_for_bad_port_number(self):
"""Test validation of port number."""
self.port_check_data["port_number"] = "not_a_number"
self.assertRaises(applications.InvalidApplicationDescription, applications._port_check, self.port_check_data) # pylint: disable=protected-access
def test_port_check_fails_for_missing_key(self):
del self.portCheckData["name"]
self.assertRaises(applications.InvalidApplicationDescription, applications._port_check, self.portCheckData)
def test_fails_for_missing_key(self):
"""Test missing name key from the port definition."""
del self.port_check_data["name"]
self.assertRaises(applications.InvalidApplicationDescription, applications._port_check, self.port_check_data) # pylint: disable=protected-access
@patch("zoe_lib.applications._validate_all_services", MagicMock())
@patch("zoe_lib.applications._port_check", MagicMock())
def test_app_validate_succeeds_for_valid_app(self):
applications.app_validate(self.appValidateData)
def test_pass_for_valid_app(self):
"""Test validation of entire app."""
applications.app_validate(self.app_validate_data)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment