mock_shade.assert_called()
mock_new_project.assert_called()
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
+ @mock.patch('unittest.TestLoader')
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_client_tests')
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_api_tests')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_success(self, *args):
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = []
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.api_check.run())
- self.assertEquals(
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=[]))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.api_check.run())
+ self.assertEqual(
testcase.TestCase.EX_OK, self.api_check.is_successful())
args[0].assert_called_with(mock.ANY)
args[1].assert_called_with(
ext_net_name='foo', image_metadata=mock.ANY,
os_creds=self.os_creds, suite=mock.ANY, use_keystone=True)
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_client_tests')
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_api_tests')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_1_of_100_ko(self, *args):
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = ['foo']
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.api_check.run())
- self.assertEquals(
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=['foo']))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.api_check.run())
+ self.assertEqual(
testcase.TestCase.EX_TESTCASE_FAILED,
self.api_check.is_successful())
args[0].assert_called_with(mock.ANY)
ext_net_name='foo', image_metadata=mock.ANY,
os_creds=self.os_creds, suite=mock.ANY, use_keystone=True)
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_client_tests')
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_api_tests')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_1_of_100_ko_criteria(self, *args):
self.api_check.criteria = 90
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = ['foo']
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.api_check.run())
- self.assertEquals(
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=['foo']))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.api_check.run())
+ self.assertEqual(
testcase.TestCase.EX_OK, self.api_check.is_successful())
args[0].assert_called_with(mock.ANY)
args[1].assert_called_with(
mock_shade.assert_called()
mock_new_project.assert_called()
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
@mock.patch('snaps.openstack.tests.os_source_file_test.'
'OSIntegrationTestCase.parameterize')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_success(self, *args):
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = []
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.health_check.run())
- self.assertEquals(
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=[]))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.health_check.run())
+ self.assertEqual(
testcase.TestCase.EX_OK, self.health_check.is_successful())
args[0].assert_called_with(mock.ANY)
args[1].assert_called_with(
image_metadata=mock.ANY, netconf_override=None,
os_creds=self.os_creds, use_keystone=True)
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
@mock.patch('snaps.openstack.tests.os_source_file_test.'
'OSIntegrationTestCase.parameterize')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_1_of_100_ko(self, *args):
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = ['foo']
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.health_check.run())
- self.assertEquals(
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=['foo']))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.health_check.run())
+ self.assertEqual(
testcase.TestCase.EX_TESTCASE_FAILED,
self.health_check.is_successful())
args[0].assert_called_with(mock.ANY)
image_metadata=mock.ANY, netconf_override=None,
os_creds=self.os_creds, use_keystone=True)
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
@mock.patch('snaps.openstack.tests.os_source_file_test.'
'OSIntegrationTestCase.parameterize')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_1_of_100_ko_criteria(self, *args):
self.health_check.criteria = 90
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = ['foo']
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.health_check.run())
- self.assertEquals(
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=['foo']))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.health_check.run())
+ self.assertEqual(
testcase.TestCase.EX_OK, self.health_check.is_successful())
args[0].assert_called_with(mock.ANY)
args[1].assert_called_with(
mock_shade.assert_called()
mock_new_project.assert_called()
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_integration_tests')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_success(self, *args):
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = []
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.smoke.run())
- self.assertEquals(testcase.TestCase.EX_OK, self.smoke.is_successful())
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=[]))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.smoke.run())
+ self.assertEqual(testcase.TestCase.EX_OK, self.smoke.is_successful())
args[0].assert_called_with(mock.ANY)
args[1].assert_called_with(
ext_net_name='foo', flavor_metadata=mock.ANY,
os_creds=self.os_creds, suite=mock.ANY, use_floating_ips=True,
use_keystone=True)
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_integration_tests')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_1_of_100_ko(self, *args):
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = ['foo']
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.smoke.run())
- self.assertEquals(
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=['foo']))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.smoke.run())
+ self.assertEqual(
testcase.TestCase.EX_TESTCASE_FAILED, self.smoke.is_successful())
args[0].assert_called_with(mock.ANY)
args[1].assert_called_with(
os_creds=self.os_creds, suite=mock.ANY, use_floating_ips=True,
use_keystone=True)
+ @mock.patch('xtesting.core.unit.Suite.generate_html')
+ @mock.patch('xtesting.core.unit.Suite.generate_xunit')
+ @mock.patch('xtesting.core.unit.Suite.generate_stats')
+ @mock.patch('os.path.isdir', return_value=True)
@mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.'
'add_openstack_integration_tests')
- @mock.patch('unittest.TextTestRunner.run',
- return_value=mock.MagicMock(name='unittest.TextTestResult'))
+ @mock.patch('subunit.run.SubunitTestRunner.run')
def test_run_1_of_100_ko_criteria(self, *args):
self.smoke.criteria = 90
- args[0].return_value.testsRun = 100
- args[0].return_value.failures = ['foo']
- args[0].return_value.errors = []
- self.assertEquals(testcase.TestCase.EX_OK, self.smoke.run())
- self.assertEquals(
+ args[0].return_value = mock.Mock(
+ decorated=mock.Mock(
+ testsRun=100, errors=[], failures=['foo']))
+ with mock.patch('six.moves.builtins.open', mock.mock_open()):
+ self.assertEqual(testcase.TestCase.EX_OK, self.smoke.run())
+ self.assertEqual(
testcase.TestCase.EX_OK, self.smoke.is_successful())
args[0].assert_called_with(mock.ANY)
args[1].assert_called_with(