Best Python code snippet using lemoncheesecake
test_suitesconfig.py
Source:test_suitesconfig.py
1"""Unit tests for buildscripts/resmokelib/suitesconfig.py."""2import unittest3import mock4from buildscripts.resmokelib import parser5from buildscripts.resmokelib import suitesconfig6parser.set_run_options()7# pylint: disable=missing-docstring8RESMOKELIB = "buildscripts.resmokelib"9class TestSuitesConfig(unittest.TestCase):10 @mock.patch(RESMOKELIB + ".testing.suite.Suite")11 @mock.patch(RESMOKELIB + ".suitesconfig.get_named_suites")12 def test_no_suites_matching_test_kind(self, mock_get_named_suites, mock_suite_class):13 all_suites = ["core", "replica_sets_jscore_passthrough"]14 mock_get_named_suites.return_value = all_suites15 membership_map = suitesconfig.create_test_membership_map(test_kind="nonexistent_test")16 self.assertEqual(membership_map, {})17 self.assertEqual(mock_suite_class.call_count, 2)18 @mock.patch(RESMOKELIB + ".testing.suite.Suite.tests")19 @mock.patch(RESMOKELIB + ".suitesconfig.get_named_suites")20 def test_multiple_suites_matching_single_test_kind(self, mock_get_named_suites,21 mock_suite_get_tests):22 all_suites = ["core", "replica_sets_jscore_passthrough"]23 mock_get_named_suites.return_value = all_suites24 mock_suite_get_tests.__get__ = mock.Mock(return_value=["test1", "test2"])25 membership_map = suitesconfig.create_test_membership_map(test_kind="js_test")26 self.assertEqual(membership_map, dict(test1=all_suites, test2=all_suites))27 @mock.patch(RESMOKELIB + ".testing.suite.Suite.tests")28 @mock.patch(RESMOKELIB + ".suitesconfig.get_named_suites")29 def test_multiple_suites_matching_multiple_test_kinds(self, mock_get_named_suites,30 mock_suite_get_tests):31 all_suites = ["core", "concurrency"]32 mock_get_named_suites.return_value = all_suites33 mock_suite_get_tests.__get__ = mock.Mock(return_value=["test1", "test2"])34 membership_map = suitesconfig.create_test_membership_map(35 test_kind=("fsm_workload_test", "js_test"))...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!