1
@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.hfrom apps.route.optimizers.simple_route_opt import RouteOpt
from osdf.utils.interfaces import json_from_file
from unittest.mock import patch
import osdf.config.loader as config_loader
from osdf.utils.programming_utils import DotDict
import unittest
class TestSimpleRouteOptimization(unittest.TestCase):
@patch('apps.route.optimizers.simple_route_opt.requests.get')
@patch('apps.route.optimizers.simple_route_opt.pymzn.minizinc')
def test_process_nst_selection_solutions( self, mock_solve, mock_get):
main_dir = ""
response_data_file = main_dir + "test/simple_route_opt/AAI.json"
mock_get.return_value.json.return_value = json_from_file(response_data_file)
mock_get.return_value.status_code = 200
mock_solve.return_value = [{'x': [1, 1, 1]}]
self.config_spec = {
"deployment": "test/functest/simulators/simulated-config/osdf_config.yaml",
"core": "test/functest/simulators/simulated-config/common_config.yaml"
}
self.osdf_config = DotDict(config_loader.all_configs(**self.config_spec))
parameter_data_file = main_dir + "test/simple_route_opt/routeOpt.json"
request_json = json_from_file(parameter_data_file)
mock_response = {
"requestId": "yyy-yyy-yyyy",
"requestStatus": "accepted",
"solutions": [
{
"end_node": "10.10.10.10",
"link": "link-id-1",
"start_node": "20.20.20.20"
},
{
"end_node": "11.11.11.11",
"link": "link-id-2",
"start_node": "22.22.22.22"
},
{
"end_node": "20.20.20.20",
"link": "link-id-3",
"start_node": "11.11.11.11"
}
],
"statusMessage": " ",
"transactionId": "xxx-xxx-xxxx"
}
routopt = RouteOpt()
actual_response = routopt.get_route(request_json,self.osdf_config)
self.assertEqual(mock_response, actual_response)
if __name__ == '__main__':
unittest.main()
|