aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/utils/test_utils.py
diff options
context:
space:
mode:
authorashishk1994 <ashishk.iiit@gmail.com>2016-12-28 00:02:50 +0530
committerashishk1994 <ashishk.iiit@gmail.com>2017-01-02 22:32:34 +0530
commitc862c31c3b52de324157373f4ccc0fa5674a5806 (patch)
tree2db9b15f49e977723ab64e0ee89add0d44518678 /functest/tests/unit/utils/test_utils.py
parent05586c3163efe605024b9186f2f1a04c741e2068 (diff)
Added unit tests for utils/functest_utils.py.
JIRA: FUNCTEST-683 Change-Id: I181d98847b2ca94ce84a670239b8a958bfae44cd Signed-off-by: ashishk1994 <ashishk.iiit@gmail.com>
Diffstat (limited to 'functest/tests/unit/utils/test_utils.py')
-rw-r--r--functest/tests/unit/utils/test_utils.py45
1 files changed, 0 insertions, 45 deletions
diff --git a/functest/tests/unit/utils/test_utils.py b/functest/tests/unit/utils/test_utils.py
deleted file mode 100644
index 8b6c5e1b..00000000
--- a/functest/tests/unit/utils/test_utils.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2016 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-import logging
-import mock
-import unittest
-import urllib2
-
-from functest.utils import functest_utils
-
-
-class FunctestUtilsTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.url = 'http://www.opnfv.org/'
- self.timeout = 5
-
- @mock.patch('urllib2.urlopen',
- side_effect=urllib2.URLError('no host given'))
- def test_check_internet_connectivity_failed(self, mock_method):
- self.assertFalse(functest_utils.check_internet_connectivity())
- mock_method.assert_called_once_with(self.url, timeout=self.timeout)
-
- @mock.patch('urllib2.urlopen')
- def test_check_internet_connectivity_default(self, mock_method):
- self.assertTrue(functest_utils.check_internet_connectivity())
- mock_method.assert_called_once_with(self.url, timeout=self.timeout)
-
- @mock.patch('urllib2.urlopen')
- def test_check_internet_connectivity_debian(self, mock_method):
- self.url = "https://www.debian.org/"
- self.assertTrue(functest_utils.check_internet_connectivity(self.url))
- mock_method.assert_called_once_with(self.url, timeout=self.timeout)
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)