Beispiel #1
0
    def test__variable__variable_does_not_exist__fail(self):
        self.suite.keywords.append(Keyword(name='Set service context to node_1', type='setup'))

        tests = [
            Keyword(name=u'Variable PTH: contains /usr/bin'),
        ]
        with patch('VnfValidator.orchestrator.DockerController.get_env', return_value=["PATH=/usr/bin"]):
            run_keyword_tests(test_instance=self, tests=tests, expected_result=Result.FAIL)
Beispiel #2
0
    def test__port__invalid_value__fail(self):
        self.suite.keywords.append(Keyword(name='Set network context to node_1', type='setup'))

        tests = [
            Keyword(name=u'Port 80: state is openedd'),
        ]
        with patch('ValidationTargets.port.exc.SetupError.ROBOT_EXIT_ON_FAILURE', False):
            run_keyword_tests(test_instance=self, setup=None, tests=tests, expected_result=Result.FAIL,
                              expected_message=u'ValidationError: Value')
Beispiel #3
0
    def test__variable__invalid_value__fail(self):
        self.suite.keywords.append(Keyword(name='Set service context to node_1', type='setup'))

        tests = [
            Keyword(name=u'Variable ABC: is ""'),
        ]
        with patch('ValidationTargets.variable.exc.SetupError.ROBOT_EXIT_ON_FAILURE', False):
            run_keyword_tests(test_instance=self, setup=None, tests=tests, expected_result=Result.FAIL,
                              expected_message=u'ValidationError: Value')
Beispiel #4
0
    def test__port__pass(self):
        self.suite.keywords.append(Keyword(name='Set network context to node_1', type='setup'))

        tests = [
            Keyword(name=u'Port 80: state is open'),
            Keyword(name=u'Port 80/TCP: state is open'),
            Keyword(name=u'Port 80/UDP: state is open'),
            Keyword(name=u'Port 80/UDP: state is closed'),
        ]
        run_keyword_tests(test_instance=self, tests=tests, expected_result=Result.PASS)
Beispiel #5
0
    def test__set_context__pass(self):
        tests = [
            Keyword(name=u'Set application context to node_1'),
            Keyword(name=u'Set network context to node_1'),
            Keyword(name=u'Set node context to node_1'),
            Keyword(name=u'Set service context to node_1'),
        ]

        with patch('DockerController.DockerController') as mock_controller:
            mock_controller = MagicMock(DockerController)
            run_keyword_tests(test_instance=self, tests=tests, expected_result=Result.PASS)
Beispiel #6
0
    def test__variable__pass(self):
        self.suite.keywords.append(Keyword(name='Set service context to node_1', type='setup'))

        tests = [
            Keyword(name=u'Variable PATH: contains /usr/bin'),
            Keyword(name=u'Variable PATH: is /usr/bin'),
            Keyword(name=u'Variable PATH: is "/usr/bin"'),
            Keyword(name=u'Variable PATH: is \'/usr/bin\''),
            Keyword(name=u'Variable NGINX_VERSION: contains 2.0.0beta1'),
            Keyword(name=u'Variable NGINX_VERSION: is 2.0.0beta1'),
        ]

        with patch('VnfValidator.orchestrator._get_controller') as mock:
            mock.return_value = MagicMock(DockerController)
            mock.return_value.get_env.return_value = ["PATH=/usr/bin", "NGINX_VERSION=2.0.0beta1"]
            run_keyword_tests(test_instance=self, tests=tests, expected_result=Result.PASS)