def test_write_role_nodes_profile(self, mock_open): test_nodes = copy.deepcopy(TEST_NODES) test_nodes[1]['capabilities'] = ('boot_option:local,' 'boot_mode:uefi,' 'profile:extra') args = mock.Mock() args.nodes_json = 'test.json' build_nodes_json._write_role_nodes(test_nodes, args) self.assertIn(mock.call('test-no-profile.json', 'w'), mock_open.mock_calls) self.assertIn(mock.call('test-extra.json', 'w'), mock_open.mock_calls) f = mock_open.return_value.__enter__.return_value f.write.assert_any_call( json.dumps({'nodes': [test_nodes[0]]}, indent=2)) f.write.assert_any_call( json.dumps({'nodes': [test_nodes[1]]}, indent=2))
def test_write_role_nodes(self, mock_open): test_nodes = copy.deepcopy(TEST_NODES) args = mock.Mock() args.nodes_json = 'test.json' build_nodes_json._write_role_nodes(test_nodes, args) mock_open.assert_not_called()