Best Python code snippet using localstack_python
test_apply_changes.py
Source:test_apply_changes.py
...4class Tests(unittest.TestCase):5 def test_for_apply_changes_function_presence(self):6 tags = {}7 change = {}8 apply_changes(tags, change)9 def test_simplest_applying_changes(self):10 tags = {'wikipedia': 'en:Walmart Market'}11 change = [{'to': {'wikipedia': 'en:Walmart'}, 'from': {'wikipedia': 'en:Walmart Market'}}]12 tags = apply_changes(tags, change)13 self.assertEqual({"wikipedia": "en:Walmart"}, tags)14 def test_exception_on_changing_nonexisting(self):15 self.assertRaises(PrerequisiteFailedError, apply_changes, {}, [{'from': {'key': 'value'}, 'to': {}}])16 def test_from_values_are_deleted(self):17 change = [{'from': {'key': 'value'}, 'to': {}}]18 tags = apply_changes({'key': 'value'}, change)19 self.assertEqual({}, tags)20 def test_from_values_are_deleted_on_specifying_none(self):21 change = [{'from': {'key': 'value'}, 'to': {'key': None}}]22 tags = apply_changes({'key': 'value'}, change)23 self.assertEqual({}, tags)24 def test_keys_may_be_changed(self):25 change = [{'from': {'key': 'value'}, 'to': {'new_key': 'qweert'}}]26 tags = apply_changes({'key': 'value'}, change)27 self.assertEqual({'new_key': 'qweert'}, tags)28 def test_demand_explicit_key_change(self):29 self.assertRaises(PrerequisiteFailedError, apply_changes, {'key': 'value'}, [{'from': {}, 'to': {'key': 'value'}}])30 def test_keys_may_be_added(self):31 change = [{'from': {}, 'to': {'new_key': 'qweert'}}]32 tags = apply_changes({'key': 'value'}, change)33 self.assertEqual({'key': 'value', 'new_key': 'qweert'}, tags)34 def test_keys_may_be_added_to_empty_object(self):35 change = [{'from': {}, 'to': {'new_key': 'qweert'}}]36 tags = apply_changes({}, change)37 self.assertEqual({'new_key': 'qweert'}, tags)38 def test_keys_may_be_added_previous_state_specified_by_none(self):39 change = [{'from': {'new_key': None}, 'to': {'new_key': 'qweert'}}]40 tags = apply_changes({'key': 'value'}, change)41 self.assertEqual({'key': 'value', 'new_key': 'qweert'}, tags)42if __name__ == '__main__':...
test_integration.py
Source:test_integration.py
...4import pytest5import test_utils6TEST_SERVER_NAME = 'hello-world-test'7@pytest.fixture(scope='session')8def apply_changes():9 generate_json(TEST_SERVER_NAME)10 assert os.path.exists(SERVER_CONFIGURATION_FILE)11 assert test_utils.initialize() == 012 yield test_utils.apply()13 assert test_utils.destroy() == 014 os.remove(SERVER_CONFIGURATION_FILE)15def test_changes_have_successful_return_code(apply_changes):16 return_code = apply_changes[0]17 assert return_code == 018def test_changes_should_have_no_errors(apply_changes):19 errors = apply_changes[2]20 assert errors == b''21def test_changes_should_add_1_resource(apply_changes):22 output = apply_changes[1].decode(encoding='utf-8').split('\n')...
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!!