How to use enable method in differencify

Best JavaScript code snippet using differencify

test_fortios_system_settings.py

Source:test_fortios_system_settings.py Github

copy

Full Screen

1# Copyright 2019 Fortinet, Inc.2#3# This program is free software: you can redistribute it and/or modify4# it under the terms of the GNU General Public License as published by5# the Free Software Foundation, either version 3 of the License, or6# (at your option) any later version.7#8# This program is distributed in the hope that it will be useful,9# but WITHOUT ANY WARRANTY; without even the implied warranty of10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11# GNU General Public License for more details.12#13# You should have received a copy of the GNU General Public License14# along with Ansible. If not, see <https://www.gnu.org/licenses/>.15# Make coding more python3-ish16from __future__ import (absolute_import, division, print_function)17__metaclass__ = type18import os19import json20import pytest21from mock import ANY22from ansible.module_utils.network.fortios.fortios import FortiOSHandler23try:24 from ansible.modules.network.fortios import fortios_system_settings25except ImportError:26 pytest.skip("Could not load required modules for testing", allow_module_level=True)27@pytest.fixture(autouse=True)28def connection_mock(mocker):29 connection_class_mock = mocker.patch('ansible.modules.network.fortios.fortios_system_settings.Connection')30 return connection_class_mock31fos_instance = FortiOSHandler(connection_mock)32def test_system_settings_creation(mocker):33 schema_method_mock = mocker.patch('ansible.module_utils.network.fortios.fortios.FortiOSHandler.schema')34 set_method_result = {'status': 'success', 'http_method': 'POST', 'http_status': 200}35 set_method_mock = mocker.patch('ansible.module_utils.network.fortios.fortios.FortiOSHandler.set', return_value=set_method_result)36 input_data = {37 'username': 'admin',38 'state': 'present',39 'system_settings': {40 'allow_linkdown_path': 'enable',41 'allow_subnet_overlap': 'enable',42 'asymroute': 'enable',43 'asymroute_icmp': 'enable',44 'asymroute6': 'enable',45 'asymroute6_icmp': 'enable',46 'bfd': 'enable',47 'bfd_desired_min_tx': '10',48 'bfd_detect_mult': '11',49 'bfd_dont_enforce_src_port': 'enable',50 'bfd_required_min_rx': '13',51 'block_land_attack': 'disable',52 'central_nat': 'enable',53 'comments': 'test_value_16',54 'compliance_check': 'enable',55 'default_voip_alg_mode': 'proxy-based',56 'deny_tcp_with_icmp': 'enable',57 'device': 'test_value_20',58 'dhcp_proxy': 'enable',59 'dhcp_server_ip': 'test_value_22',60 'dhcp6_server_ip': 'test_value_23',61 'discovered_device_timeout': '24',62 'ecmp_max_paths': '25',63 'email_portal_check_dns': 'disable',64 'firewall_session_dirty': 'check-all',65 'fw_session_hairpin': 'enable',66 'gateway': 'test_value_29',67 'gateway6': 'test_value_30',68 'gui_advanced_policy': 'enable',69 'gui_allow_unnamed_policy': 'enable',70 'gui_antivirus': 'enable',71 'gui_ap_profile': 'enable',72 'gui_application_control': 'enable',73 'gui_dhcp_advanced': 'enable',74 'gui_dlp': 'enable',75 'gui_dns_database': 'enable',76 'gui_dnsfilter': 'enable',77 'gui_domain_ip_reputation': 'enable',78 'gui_dos_policy': 'enable',79 'gui_dynamic_profile_display': 'enable',80 'gui_dynamic_routing': 'enable',81 'gui_email_collection': 'enable',82 'gui_endpoint_control': 'enable',83 'gui_endpoint_control_advanced': 'enable',84 'gui_explicit_proxy': 'enable',85 'gui_fortiap_split_tunneling': 'enable',86 'gui_fortiextender_controller': 'enable',87 'gui_icap': 'enable',88 'gui_implicit_policy': 'enable',89 'gui_ips': 'enable',90 'gui_load_balance': 'enable',91 'gui_local_in_policy': 'enable',92 'gui_local_reports': 'enable',93 'gui_multicast_policy': 'enable',94 'gui_multiple_interface_policy': 'enable',95 'gui_multiple_utm_profiles': 'enable',96 'gui_nat46_64': 'enable',97 'gui_object_colors': 'enable',98 'gui_policy_based_ipsec': 'enable',99 'gui_policy_learning': 'enable',100 'gui_replacement_message_groups': 'enable',101 'gui_spamfilter': 'enable',102 'gui_sslvpn_personal_bookmarks': 'enable',103 'gui_sslvpn_realms': 'enable',104 'gui_switch_controller': 'enable',105 'gui_threat_weight': 'enable',106 'gui_traffic_shaping': 'enable',107 'gui_voip_profile': 'enable',108 'gui_vpn': 'enable',109 'gui_waf_profile': 'enable',110 'gui_wan_load_balancing': 'enable',111 'gui_wanopt_cache': 'enable',112 'gui_webfilter': 'enable',113 'gui_webfilter_advanced': 'enable',114 'gui_wireless_controller': 'enable',115 'http_external_dest': 'fortiweb',116 'ike_dn_format': 'with-space',117 'ike_quick_crash_detect': 'enable',118 'ike_session_resume': 'enable',119 'implicit_allow_dns': 'enable',120 'inspection_mode': 'proxy',121 'ip': 'test_value_84',122 'ip6': 'test_value_85',123 'link_down_access': 'enable',124 'lldp_transmission': 'enable',125 'mac_ttl': '88',126 'manageip': 'test_value_89',127 'manageip6': 'test_value_90',128 'multicast_forward': 'enable',129 'multicast_skip_policy': 'enable',130 'multicast_ttl_notchange': 'enable',131 'ngfw_mode': 'profile-based',132 'opmode': 'nat',133 'prp_trailer_action': 'enable',134 'sccp_port': '97',135 'ses_denied_traffic': 'enable',136 'sip_helper': 'enable',137 'sip_nat_trace': 'enable',138 'sip_ssl_port': '101',139 'sip_tcp_port': '102',140 'sip_udp_port': '103',141 'snat_hairpin_traffic': 'enable',142 'ssl_ssh_profile': 'test_value_105',143 'status': 'enable',144 'strict_src_check': 'enable',145 'tcp_session_without_syn': 'enable',146 'utf8_spam_tagging': 'enable',147 'v4_ecmp_mode': 'source-ip-based',148 'vpn_stats_log': 'ipsec',149 'vpn_stats_period': '112',150 'wccp_cache_engine': 'enable'151 },152 'vdom': 'root'}153 is_error, changed, response = fortios_system_settings.fortios_system(input_data, fos_instance)154 expected_data = {155 'allow-linkdown-path': 'enable',156 'allow-subnet-overlap': 'enable',157 'asymroute': 'enable',158 'asymroute-icmp': 'enable',159 'asymroute6': 'enable',160 'asymroute6-icmp': 'enable',161 'bfd': 'enable',162 'bfd-desired-min-tx': '10',163 'bfd-detect-mult': '11',164 'bfd-dont-enforce-src-port': 'enable',165 'bfd-required-min-rx': '13',166 'block-land-attack': 'disable',167 'central-nat': 'enable',168 'comments': 'test_value_16',169 'compliance-check': 'enable',170 'default-voip-alg-mode': 'proxy-based',171 'deny-tcp-with-icmp': 'enable',172 'device': 'test_value_20',173 'dhcp-proxy': 'enable',174 'dhcp-server-ip': 'test_value_22',175 'dhcp6-server-ip': 'test_value_23',176 'discovered-device-timeout': '24',177 'ecmp-max-paths': '25',178 'email-portal-check-dns': 'disable',179 'firewall-session-dirty': 'check-all',180 'fw-session-hairpin': 'enable',181 'gateway': 'test_value_29',182 'gateway6': 'test_value_30',183 'gui-advanced-policy': 'enable',184 'gui-allow-unnamed-policy': 'enable',185 'gui-antivirus': 'enable',186 'gui-ap-profile': 'enable',187 'gui-application-control': 'enable',188 'gui-dhcp-advanced': 'enable',189 'gui-dlp': 'enable',190 'gui-dns-database': 'enable',191 'gui-dnsfilter': 'enable',192 'gui-domain-ip-reputation': 'enable',193 'gui-dos-policy': 'enable',194 'gui-dynamic-profile-display': 'enable',195 'gui-dynamic-routing': 'enable',196 'gui-email-collection': 'enable',197 'gui-endpoint-control': 'enable',198 'gui-endpoint-control-advanced': 'enable',199 'gui-explicit-proxy': 'enable',200 'gui-fortiap-split-tunneling': 'enable',201 'gui-fortiextender-controller': 'enable',202 'gui-icap': 'enable',203 'gui-implicit-policy': 'enable',204 'gui-ips': 'enable',205 'gui-load-balance': 'enable',206 'gui-local-in-policy': 'enable',207 'gui-local-reports': 'enable',208 'gui-multicast-policy': 'enable',209 'gui-multiple-interface-policy': 'enable',210 'gui-multiple-utm-profiles': 'enable',211 'gui-nat46-64': 'enable',212 'gui-object-colors': 'enable',213 'gui-policy-based-ipsec': 'enable',214 'gui-policy-learning': 'enable',215 'gui-replacement-message-groups': 'enable',216 'gui-spamfilter': 'enable',217 'gui-sslvpn-personal-bookmarks': 'enable',218 'gui-sslvpn-realms': 'enable',219 'gui-switch-controller': 'enable',220 'gui-threat-weight': 'enable',221 'gui-traffic-shaping': 'enable',222 'gui-voip-profile': 'enable',223 'gui-vpn': 'enable',224 'gui-waf-profile': 'enable',225 'gui-wan-load-balancing': 'enable',226 'gui-wanopt-cache': 'enable',227 'gui-webfilter': 'enable',228 'gui-webfilter-advanced': 'enable',229 'gui-wireless-controller': 'enable',230 'http-external-dest': 'fortiweb',231 'ike-dn-format': 'with-space',232 'ike-quick-crash-detect': 'enable',233 'ike-session-resume': 'enable',234 'implicit-allow-dns': 'enable',235 'inspection-mode': 'proxy',236 'ip': 'test_value_84',237 'ip6': 'test_value_85',238 'link-down-access': 'enable',239 'lldp-transmission': 'enable',240 'mac-ttl': '88',241 'manageip': 'test_value_89',242 'manageip6': 'test_value_90',243 'multicast-forward': 'enable',244 'multicast-skip-policy': 'enable',245 'multicast-ttl-notchange': 'enable',246 'ngfw-mode': 'profile-based',247 'opmode': 'nat',248 'prp-trailer-action': 'enable',249 'sccp-port': '97',250 'ses-denied-traffic': 'enable',251 'sip-helper': 'enable',252 'sip-nat-trace': 'enable',253 'sip-ssl-port': '101',254 'sip-tcp-port': '102',255 'sip-udp-port': '103',256 'snat-hairpin-traffic': 'enable',257 'ssl-ssh-profile': 'test_value_105',258 'status': 'enable',259 'strict-src-check': 'enable',260 'tcp-session-without-syn': 'enable',261 'utf8-spam-tagging': 'enable',262 'v4-ecmp-mode': 'source-ip-based',263 'vpn-stats-log': 'ipsec',264 'vpn-stats-period': '112',265 'wccp-cache-engine': 'enable'266 }267 set_method_mock.assert_called_with('system', 'settings', data=expected_data, vdom='root')268 schema_method_mock.assert_not_called()269 assert not is_error270 assert changed271 assert response['status'] == 'success'272 assert response['http_status'] == 200273def test_system_settings_creation_fails(mocker):274 schema_method_mock = mocker.patch('ansible.module_utils.network.fortios.fortios.FortiOSHandler.schema')275 set_method_result = {'status': 'error', 'http_method': 'POST', 'http_status': 500}276 set_method_mock = mocker.patch('ansible.module_utils.network.fortios.fortios.FortiOSHandler.set', return_value=set_method_result)277 input_data = {278 'username': 'admin',279 'state': 'present',280 'system_settings': {281 'allow_linkdown_path': 'enable',282 'allow_subnet_overlap': 'enable',283 'asymroute': 'enable',284 'asymroute_icmp': 'enable',285 'asymroute6': 'enable',286 'asymroute6_icmp': 'enable',287 'bfd': 'enable',288 'bfd_desired_min_tx': '10',289 'bfd_detect_mult': '11',290 'bfd_dont_enforce_src_port': 'enable',291 'bfd_required_min_rx': '13',292 'block_land_attack': 'disable',293 'central_nat': 'enable',294 'comments': 'test_value_16',295 'compliance_check': 'enable',296 'default_voip_alg_mode': 'proxy-based',297 'deny_tcp_with_icmp': 'enable',298 'device': 'test_value_20',299 'dhcp_proxy': 'enable',300 'dhcp_server_ip': 'test_value_22',301 'dhcp6_server_ip': 'test_value_23',302 'discovered_device_timeout': '24',303 'ecmp_max_paths': '25',304 'email_portal_check_dns': 'disable',305 'firewall_session_dirty': 'check-all',306 'fw_session_hairpin': 'enable',307 'gateway': 'test_value_29',308 'gateway6': 'test_value_30',309 'gui_advanced_policy': 'enable',310 'gui_allow_unnamed_policy': 'enable',311 'gui_antivirus': 'enable',312 'gui_ap_profile': 'enable',313 'gui_application_control': 'enable',314 'gui_dhcp_advanced': 'enable',315 'gui_dlp': 'enable',316 'gui_dns_database': 'enable',317 'gui_dnsfilter': 'enable',318 'gui_domain_ip_reputation': 'enable',319 'gui_dos_policy': 'enable',320 'gui_dynamic_profile_display': 'enable',321 'gui_dynamic_routing': 'enable',322 'gui_email_collection': 'enable',323 'gui_endpoint_control': 'enable',324 'gui_endpoint_control_advanced': 'enable',325 'gui_explicit_proxy': 'enable',326 'gui_fortiap_split_tunneling': 'enable',327 'gui_fortiextender_controller': 'enable',328 'gui_icap': 'enable',329 'gui_implicit_policy': 'enable',330 'gui_ips': 'enable',331 'gui_load_balance': 'enable',332 'gui_local_in_policy': 'enable',333 'gui_local_reports': 'enable',334 'gui_multicast_policy': 'enable',335 'gui_multiple_interface_policy': 'enable',336 'gui_multiple_utm_profiles': 'enable',337 'gui_nat46_64': 'enable',338 'gui_object_colors': 'enable',339 'gui_policy_based_ipsec': 'enable',340 'gui_policy_learning': 'enable',341 'gui_replacement_message_groups': 'enable',342 'gui_spamfilter': 'enable',343 'gui_sslvpn_personal_bookmarks': 'enable',344 'gui_sslvpn_realms': 'enable',345 'gui_switch_controller': 'enable',346 'gui_threat_weight': 'enable',347 'gui_traffic_shaping': 'enable',348 'gui_voip_profile': 'enable',349 'gui_vpn': 'enable',350 'gui_waf_profile': 'enable',351 'gui_wan_load_balancing': 'enable',352 'gui_wanopt_cache': 'enable',353 'gui_webfilter': 'enable',354 'gui_webfilter_advanced': 'enable',355 'gui_wireless_controller': 'enable',356 'http_external_dest': 'fortiweb',357 'ike_dn_format': 'with-space',358 'ike_quick_crash_detect': 'enable',359 'ike_session_resume': 'enable',360 'implicit_allow_dns': 'enable',361 'inspection_mode': 'proxy',362 'ip': 'test_value_84',363 'ip6': 'test_value_85',364 'link_down_access': 'enable',365 'lldp_transmission': 'enable',366 'mac_ttl': '88',367 'manageip': 'test_value_89',368 'manageip6': 'test_value_90',369 'multicast_forward': 'enable',370 'multicast_skip_policy': 'enable',371 'multicast_ttl_notchange': 'enable',372 'ngfw_mode': 'profile-based',373 'opmode': 'nat',374 'prp_trailer_action': 'enable',375 'sccp_port': '97',376 'ses_denied_traffic': 'enable',377 'sip_helper': 'enable',378 'sip_nat_trace': 'enable',379 'sip_ssl_port': '101',380 'sip_tcp_port': '102',381 'sip_udp_port': '103',382 'snat_hairpin_traffic': 'enable',383 'ssl_ssh_profile': 'test_value_105',384 'status': 'enable',385 'strict_src_check': 'enable',386 'tcp_session_without_syn': 'enable',387 'utf8_spam_tagging': 'enable',388 'v4_ecmp_mode': 'source-ip-based',389 'vpn_stats_log': 'ipsec',390 'vpn_stats_period': '112',391 'wccp_cache_engine': 'enable'392 },393 'vdom': 'root'}394 is_error, changed, response = fortios_system_settings.fortios_system(input_data, fos_instance)395 expected_data = {396 'allow-linkdown-path': 'enable',397 'allow-subnet-overlap': 'enable',398 'asymroute': 'enable',399 'asymroute-icmp': 'enable',400 'asymroute6': 'enable',401 'asymroute6-icmp': 'enable',402 'bfd': 'enable',403 'bfd-desired-min-tx': '10',404 'bfd-detect-mult': '11',405 'bfd-dont-enforce-src-port': 'enable',406 'bfd-required-min-rx': '13',407 'block-land-attack': 'disable',408 'central-nat': 'enable',409 'comments': 'test_value_16',410 'compliance-check': 'enable',411 'default-voip-alg-mode': 'proxy-based',412 'deny-tcp-with-icmp': 'enable',413 'device': 'test_value_20',414 'dhcp-proxy': 'enable',415 'dhcp-server-ip': 'test_value_22',416 'dhcp6-server-ip': 'test_value_23',417 'discovered-device-timeout': '24',418 'ecmp-max-paths': '25',419 'email-portal-check-dns': 'disable',420 'firewall-session-dirty': 'check-all',421 'fw-session-hairpin': 'enable',422 'gateway': 'test_value_29',423 'gateway6': 'test_value_30',424 'gui-advanced-policy': 'enable',425 'gui-allow-unnamed-policy': 'enable',426 'gui-antivirus': 'enable',427 'gui-ap-profile': 'enable',428 'gui-application-control': 'enable',429 'gui-dhcp-advanced': 'enable',430 'gui-dlp': 'enable',431 'gui-dns-database': 'enable',432 'gui-dnsfilter': 'enable',433 'gui-domain-ip-reputation': 'enable',434 'gui-dos-policy': 'enable',435 'gui-dynamic-profile-display': 'enable',436 'gui-dynamic-routing': 'enable',437 'gui-email-collection': 'enable',438 'gui-endpoint-control': 'enable',439 'gui-endpoint-control-advanced': 'enable',440 'gui-explicit-proxy': 'enable',441 'gui-fortiap-split-tunneling': 'enable',442 'gui-fortiextender-controller': 'enable',443 'gui-icap': 'enable',444 'gui-implicit-policy': 'enable',445 'gui-ips': 'enable',446 'gui-load-balance': 'enable',447 'gui-local-in-policy': 'enable',448 'gui-local-reports': 'enable',449 'gui-multicast-policy': 'enable',450 'gui-multiple-interface-policy': 'enable',451 'gui-multiple-utm-profiles': 'enable',452 'gui-nat46-64': 'enable',453 'gui-object-colors': 'enable',454 'gui-policy-based-ipsec': 'enable',455 'gui-policy-learning': 'enable',456 'gui-replacement-message-groups': 'enable',457 'gui-spamfilter': 'enable',458 'gui-sslvpn-personal-bookmarks': 'enable',459 'gui-sslvpn-realms': 'enable',460 'gui-switch-controller': 'enable',461 'gui-threat-weight': 'enable',462 'gui-traffic-shaping': 'enable',463 'gui-voip-profile': 'enable',464 'gui-vpn': 'enable',465 'gui-waf-profile': 'enable',466 'gui-wan-load-balancing': 'enable',467 'gui-wanopt-cache': 'enable',468 'gui-webfilter': 'enable',469 'gui-webfilter-advanced': 'enable',470 'gui-wireless-controller': 'enable',471 'http-external-dest': 'fortiweb',472 'ike-dn-format': 'with-space',473 'ike-quick-crash-detect': 'enable',474 'ike-session-resume': 'enable',475 'implicit-allow-dns': 'enable',476 'inspection-mode': 'proxy',477 'ip': 'test_value_84',478 'ip6': 'test_value_85',479 'link-down-access': 'enable',480 'lldp-transmission': 'enable',481 'mac-ttl': '88',482 'manageip': 'test_value_89',483 'manageip6': 'test_value_90',484 'multicast-forward': 'enable',485 'multicast-skip-policy': 'enable',486 'multicast-ttl-notchange': 'enable',487 'ngfw-mode': 'profile-based',488 'opmode': 'nat',489 'prp-trailer-action': 'enable',490 'sccp-port': '97',491 'ses-denied-traffic': 'enable',492 'sip-helper': 'enable',493 'sip-nat-trace': 'enable',494 'sip-ssl-port': '101',495 'sip-tcp-port': '102',496 'sip-udp-port': '103',497 'snat-hairpin-traffic': 'enable',498 'ssl-ssh-profile': 'test_value_105',499 'status': 'enable',500 'strict-src-check': 'enable',501 'tcp-session-without-syn': 'enable',502 'utf8-spam-tagging': 'enable',503 'v4-ecmp-mode': 'source-ip-based',504 'vpn-stats-log': 'ipsec',505 'vpn-stats-period': '112',506 'wccp-cache-engine': 'enable'507 }508 set_method_mock.assert_called_with('system', 'settings', data=expected_data, vdom='root')509 schema_method_mock.assert_not_called()510 assert is_error511 assert not changed512 assert response['status'] == 'error'513 assert response['http_status'] == 500514def test_system_settings_idempotent(mocker):515 schema_method_mock = mocker.patch('ansible.module_utils.network.fortios.fortios.FortiOSHandler.schema')516 set_method_result = {'status': 'error', 'http_method': 'DELETE', 'http_status': 404}517 set_method_mock = mocker.patch('ansible.module_utils.network.fortios.fortios.FortiOSHandler.set', return_value=set_method_result)518 input_data = {519 'username': 'admin',520 'state': 'present',521 'system_settings': {522 'allow_linkdown_path': 'enable',523 'allow_subnet_overlap': 'enable',524 'asymroute': 'enable',525 'asymroute_icmp': 'enable',526 'asymroute6': 'enable',527 'asymroute6_icmp': 'enable',528 'bfd': 'enable',529 'bfd_desired_min_tx': '10',530 'bfd_detect_mult': '11',531 'bfd_dont_enforce_src_port': 'enable',532 'bfd_required_min_rx': '13',533 'block_land_attack': 'disable',534 'central_nat': 'enable',535 'comments': 'test_value_16',536 'compliance_check': 'enable',537 'default_voip_alg_mode': 'proxy-based',538 'deny_tcp_with_icmp': 'enable',539 'device': 'test_value_20',540 'dhcp_proxy': 'enable',541 'dhcp_server_ip': 'test_value_22',542 'dhcp6_server_ip': 'test_value_23',543 'discovered_device_timeout': '24',544 'ecmp_max_paths': '25',545 'email_portal_check_dns': 'disable',546 'firewall_session_dirty': 'check-all',547 'fw_session_hairpin': 'enable',548 'gateway': 'test_value_29',549 'gateway6': 'test_value_30',550 'gui_advanced_policy': 'enable',551 'gui_allow_unnamed_policy': 'enable',552 'gui_antivirus': 'enable',553 'gui_ap_profile': 'enable',554 'gui_application_control': 'enable',555 'gui_dhcp_advanced': 'enable',556 'gui_dlp': 'enable',557 'gui_dns_database': 'enable',558 'gui_dnsfilter': 'enable',559 'gui_domain_ip_reputation': 'enable',560 'gui_dos_policy': 'enable',561 'gui_dynamic_profile_display': 'enable',562 'gui_dynamic_routing': 'enable',563 'gui_email_collection': 'enable',564 'gui_endpoint_control': 'enable',565 'gui_endpoint_control_advanced': 'enable',566 'gui_explicit_proxy': 'enable',567 'gui_fortiap_split_tunneling': 'enable',568 'gui_fortiextender_controller': 'enable',569 'gui_icap': 'enable',570 'gui_implicit_policy': 'enable',571 'gui_ips': 'enable',572 'gui_load_balance': 'enable',573 'gui_local_in_policy': 'enable',574 'gui_local_reports': 'enable',575 'gui_multicast_policy': 'enable',576 'gui_multiple_interface_policy': 'enable',577 'gui_multiple_utm_profiles': 'enable',578 'gui_nat46_64': 'enable',579 'gui_object_colors': 'enable',580 'gui_policy_based_ipsec': 'enable',581 'gui_policy_learning': 'enable',582 'gui_replacement_message_groups': 'enable',583 'gui_spamfilter': 'enable',584 'gui_sslvpn_personal_bookmarks': 'enable',585 'gui_sslvpn_realms': 'enable',586 'gui_switch_controller': 'enable',587 'gui_threat_weight': 'enable',588 'gui_traffic_shaping': 'enable',589 'gui_voip_profile': 'enable',590 'gui_vpn': 'enable',591 'gui_waf_profile': 'enable',592 'gui_wan_load_balancing': 'enable',593 'gui_wanopt_cache': 'enable',594 'gui_webfilter': 'enable',595 'gui_webfilter_advanced': 'enable',596 'gui_wireless_controller': 'enable',597 'http_external_dest': 'fortiweb',598 'ike_dn_format': 'with-space',599 'ike_quick_crash_detect': 'enable',600 'ike_session_resume': 'enable',601 'implicit_allow_dns': 'enable',602 'inspection_mode': 'proxy',603 'ip': 'test_value_84',604 'ip6': 'test_value_85',605 'link_down_access': 'enable',606 'lldp_transmission': 'enable',607 'mac_ttl': '88',608 'manageip': 'test_value_89',609 'manageip6': 'test_value_90',610 'multicast_forward': 'enable',611 'multicast_skip_policy': 'enable',612 'multicast_ttl_notchange': 'enable',613 'ngfw_mode': 'profile-based',614 'opmode': 'nat',615 'prp_trailer_action': 'enable',616 'sccp_port': '97',617 'ses_denied_traffic': 'enable',618 'sip_helper': 'enable',619 'sip_nat_trace': 'enable',620 'sip_ssl_port': '101',621 'sip_tcp_port': '102',622 'sip_udp_port': '103',623 'snat_hairpin_traffic': 'enable',624 'ssl_ssh_profile': 'test_value_105',625 'status': 'enable',626 'strict_src_check': 'enable',627 'tcp_session_without_syn': 'enable',628 'utf8_spam_tagging': 'enable',629 'v4_ecmp_mode': 'source-ip-based',630 'vpn_stats_log': 'ipsec',631 'vpn_stats_period': '112',632 'wccp_cache_engine': 'enable'633 },634 'vdom': 'root'}635 is_error, changed, response = fortios_system_settings.fortios_system(input_data, fos_instance)636 expected_data = {637 'allow-linkdown-path': 'enable',638 'allow-subnet-overlap': 'enable',639 'asymroute': 'enable',640 'asymroute-icmp': 'enable',641 'asymroute6': 'enable',642 'asymroute6-icmp': 'enable',643 'bfd': 'enable',644 'bfd-desired-min-tx': '10',645 'bfd-detect-mult': '11',646 'bfd-dont-enforce-src-port': 'enable',647 'bfd-required-min-rx': '13',648 'block-land-attack': 'disable',649 'central-nat': 'enable',650 'comments': 'test_value_16',651 'compliance-check': 'enable',652 'default-voip-alg-mode': 'proxy-based',653 'deny-tcp-with-icmp': 'enable',654 'device': 'test_value_20',655 'dhcp-proxy': 'enable',656 'dhcp-server-ip': 'test_value_22',657 'dhcp6-server-ip': 'test_value_23',658 'discovered-device-timeout': '24',659 'ecmp-max-paths': '25',660 'email-portal-check-dns': 'disable',661 'firewall-session-dirty': 'check-all',662 'fw-session-hairpin': 'enable',663 'gateway': 'test_value_29',664 'gateway6': 'test_value_30',665 'gui-advanced-policy': 'enable',666 'gui-allow-unnamed-policy': 'enable',667 'gui-antivirus': 'enable',668 'gui-ap-profile': 'enable',669 'gui-application-control': 'enable',670 'gui-dhcp-advanced': 'enable',671 'gui-dlp': 'enable',672 'gui-dns-database': 'enable',673 'gui-dnsfilter': 'enable',674 'gui-domain-ip-reputation': 'enable',675 'gui-dos-policy': 'enable',676 'gui-dynamic-profile-display': 'enable',677 'gui-dynamic-routing': 'enable',678 'gui-email-collection': 'enable',679 'gui-endpoint-control': 'enable',680 'gui-endpoint-control-advanced': 'enable',681 'gui-explicit-proxy': 'enable',682 'gui-fortiap-split-tunneling': 'enable',683 'gui-fortiextender-controller': 'enable',684 'gui-icap': 'enable',685 'gui-implicit-policy': 'enable',686 'gui-ips': 'enable',687 'gui-load-balance': 'enable',688 'gui-local-in-policy': 'enable',689 'gui-local-reports': 'enable',690 'gui-multicast-policy': 'enable',691 'gui-multiple-interface-policy': 'enable',692 'gui-multiple-utm-profiles': 'enable',693 'gui-nat46-64': 'enable',694 'gui-object-colors': 'enable',695 'gui-policy-based-ipsec': 'enable',696 'gui-policy-learning': 'enable',697 'gui-replacement-message-groups': 'enable',698 'gui-spamfilter': 'enable',699 'gui-sslvpn-personal-bookmarks': 'enable',700 'gui-sslvpn-realms': 'enable',701 'gui-switch-controller': 'enable',702 'gui-threat-weight': 'enable',703 'gui-traffic-shaping': 'enable',704 'gui-voip-profile': 'enable',705 'gui-vpn': 'enable',706 'gui-waf-profile': 'enable',707 'gui-wan-load-balancing': 'enable',708 'gui-wanopt-cache': 'enable',709 'gui-webfilter': 'enable',710 'gui-webfilter-advanced': 'enable',711 'gui-wireless-controller': 'enable',712 'http-external-dest': 'fortiweb',713 'ike-dn-format': 'with-space',714 'ike-quick-crash-detect': 'enable',715 'ike-session-resume': 'enable',716 'implicit-allow-dns': 'enable',717 'inspection-mode': 'proxy',718 'ip': 'test_value_84',719 'ip6': 'test_value_85',720 'link-down-access': 'enable',721 'lldp-transmission': 'enable',722 'mac-ttl': '88',723 'manageip': 'test_value_89',724 'manageip6': 'test_value_90',725 'multicast-forward': 'enable',726 'multicast-skip-policy': 'enable',727 'multicast-ttl-notchange': 'enable',728 'ngfw-mode': 'profile-based',729 'opmode': 'nat',730 'prp-trailer-action': 'enable',731 'sccp-port': '97',732 'ses-denied-traffic': 'enable',733 'sip-helper': 'enable',734 'sip-nat-trace': 'enable',735 'sip-ssl-port': '101',736 'sip-tcp-port': '102',737 'sip-udp-port': '103',738 'snat-hairpin-traffic': 'enable',739 'ssl-ssh-profile': 'test_value_105',740 'status': 'enable',741 'strict-src-check': 'enable',742 'tcp-session-without-syn': 'enable',743 'utf8-spam-tagging': 'enable',744 'v4-ecmp-mode': 'source-ip-based',745 'vpn-stats-log': 'ipsec',746 'vpn-stats-period': '112',747 'wccp-cache-engine': 'enable'748 }749 set_method_mock.assert_called_with('system', 'settings', data=expected_data, vdom='root')750 schema_method_mock.assert_not_called()751 assert not is_error752 assert not changed753 assert response['status'] == 'error'754 assert response['http_status'] == 404755def test_system_settings_filter_foreign_attributes(mocker):756 schema_method_mock = mocker.patch('ansible.module_utils.network.fortios.fortios.FortiOSHandler.schema')757 set_method_result = {'status': 'success', 'http_method': 'POST', 'http_status': 200}758 set_method_mock = mocker.patch('ansible.module_utils.network.fortios.fortios.FortiOSHandler.set', return_value=set_method_result)759 input_data = {760 'username': 'admin',761 'state': 'present',762 'system_settings': {763 'random_attribute_not_valid': 'tag',764 'allow_linkdown_path': 'enable',765 'allow_subnet_overlap': 'enable',766 'asymroute': 'enable',767 'asymroute_icmp': 'enable',768 'asymroute6': 'enable',769 'asymroute6_icmp': 'enable',770 'bfd': 'enable',771 'bfd_desired_min_tx': '10',772 'bfd_detect_mult': '11',773 'bfd_dont_enforce_src_port': 'enable',774 'bfd_required_min_rx': '13',775 'block_land_attack': 'disable',776 'central_nat': 'enable',777 'comments': 'test_value_16',778 'compliance_check': 'enable',779 'default_voip_alg_mode': 'proxy-based',780 'deny_tcp_with_icmp': 'enable',781 'device': 'test_value_20',782 'dhcp_proxy': 'enable',783 'dhcp_server_ip': 'test_value_22',784 'dhcp6_server_ip': 'test_value_23',785 'discovered_device_timeout': '24',786 'ecmp_max_paths': '25',787 'email_portal_check_dns': 'disable',788 'firewall_session_dirty': 'check-all',789 'fw_session_hairpin': 'enable',790 'gateway': 'test_value_29',791 'gateway6': 'test_value_30',792 'gui_advanced_policy': 'enable',793 'gui_allow_unnamed_policy': 'enable',794 'gui_antivirus': 'enable',795 'gui_ap_profile': 'enable',796 'gui_application_control': 'enable',797 'gui_dhcp_advanced': 'enable',798 'gui_dlp': 'enable',799 'gui_dns_database': 'enable',800 'gui_dnsfilter': 'enable',801 'gui_domain_ip_reputation': 'enable',802 'gui_dos_policy': 'enable',803 'gui_dynamic_profile_display': 'enable',804 'gui_dynamic_routing': 'enable',805 'gui_email_collection': 'enable',806 'gui_endpoint_control': 'enable',807 'gui_endpoint_control_advanced': 'enable',808 'gui_explicit_proxy': 'enable',809 'gui_fortiap_split_tunneling': 'enable',810 'gui_fortiextender_controller': 'enable',811 'gui_icap': 'enable',812 'gui_implicit_policy': 'enable',813 'gui_ips': 'enable',814 'gui_load_balance': 'enable',815 'gui_local_in_policy': 'enable',816 'gui_local_reports': 'enable',817 'gui_multicast_policy': 'enable',818 'gui_multiple_interface_policy': 'enable',819 'gui_multiple_utm_profiles': 'enable',820 'gui_nat46_64': 'enable',821 'gui_object_colors': 'enable',822 'gui_policy_based_ipsec': 'enable',823 'gui_policy_learning': 'enable',824 'gui_replacement_message_groups': 'enable',825 'gui_spamfilter': 'enable',826 'gui_sslvpn_personal_bookmarks': 'enable',827 'gui_sslvpn_realms': 'enable',828 'gui_switch_controller': 'enable',829 'gui_threat_weight': 'enable',830 'gui_traffic_shaping': 'enable',831 'gui_voip_profile': 'enable',832 'gui_vpn': 'enable',833 'gui_waf_profile': 'enable',834 'gui_wan_load_balancing': 'enable',835 'gui_wanopt_cache': 'enable',836 'gui_webfilter': 'enable',837 'gui_webfilter_advanced': 'enable',838 'gui_wireless_controller': 'enable',839 'http_external_dest': 'fortiweb',840 'ike_dn_format': 'with-space',841 'ike_quick_crash_detect': 'enable',842 'ike_session_resume': 'enable',843 'implicit_allow_dns': 'enable',844 'inspection_mode': 'proxy',845 'ip': 'test_value_84',846 'ip6': 'test_value_85',847 'link_down_access': 'enable',848 'lldp_transmission': 'enable',849 'mac_ttl': '88',850 'manageip': 'test_value_89',851 'manageip6': 'test_value_90',852 'multicast_forward': 'enable',853 'multicast_skip_policy': 'enable',854 'multicast_ttl_notchange': 'enable',855 'ngfw_mode': 'profile-based',856 'opmode': 'nat',857 'prp_trailer_action': 'enable',858 'sccp_port': '97',859 'ses_denied_traffic': 'enable',860 'sip_helper': 'enable',861 'sip_nat_trace': 'enable',862 'sip_ssl_port': '101',863 'sip_tcp_port': '102',864 'sip_udp_port': '103',865 'snat_hairpin_traffic': 'enable',866 'ssl_ssh_profile': 'test_value_105',867 'status': 'enable',868 'strict_src_check': 'enable',869 'tcp_session_without_syn': 'enable',870 'utf8_spam_tagging': 'enable',871 'v4_ecmp_mode': 'source-ip-based',872 'vpn_stats_log': 'ipsec',873 'vpn_stats_period': '112',874 'wccp_cache_engine': 'enable'875 },876 'vdom': 'root'}877 is_error, changed, response = fortios_system_settings.fortios_system(input_data, fos_instance)878 expected_data = {879 'allow-linkdown-path': 'enable',880 'allow-subnet-overlap': 'enable',881 'asymroute': 'enable',882 'asymroute-icmp': 'enable',883 'asymroute6': 'enable',884 'asymroute6-icmp': 'enable',885 'bfd': 'enable',886 'bfd-desired-min-tx': '10',887 'bfd-detect-mult': '11',888 'bfd-dont-enforce-src-port': 'enable',889 'bfd-required-min-rx': '13',890 'block-land-attack': 'disable',891 'central-nat': 'enable',892 'comments': 'test_value_16',893 'compliance-check': 'enable',894 'default-voip-alg-mode': 'proxy-based',895 'deny-tcp-with-icmp': 'enable',896 'device': 'test_value_20',897 'dhcp-proxy': 'enable',898 'dhcp-server-ip': 'test_value_22',899 'dhcp6-server-ip': 'test_value_23',900 'discovered-device-timeout': '24',901 'ecmp-max-paths': '25',902 'email-portal-check-dns': 'disable',903 'firewall-session-dirty': 'check-all',904 'fw-session-hairpin': 'enable',905 'gateway': 'test_value_29',906 'gateway6': 'test_value_30',907 'gui-advanced-policy': 'enable',908 'gui-allow-unnamed-policy': 'enable',909 'gui-antivirus': 'enable',910 'gui-ap-profile': 'enable',911 'gui-application-control': 'enable',912 'gui-dhcp-advanced': 'enable',913 'gui-dlp': 'enable',914 'gui-dns-database': 'enable',915 'gui-dnsfilter': 'enable',916 'gui-domain-ip-reputation': 'enable',917 'gui-dos-policy': 'enable',918 'gui-dynamic-profile-display': 'enable',919 'gui-dynamic-routing': 'enable',920 'gui-email-collection': 'enable',921 'gui-endpoint-control': 'enable',922 'gui-endpoint-control-advanced': 'enable',923 'gui-explicit-proxy': 'enable',924 'gui-fortiap-split-tunneling': 'enable',925 'gui-fortiextender-controller': 'enable',926 'gui-icap': 'enable',927 'gui-implicit-policy': 'enable',928 'gui-ips': 'enable',929 'gui-load-balance': 'enable',930 'gui-local-in-policy': 'enable',931 'gui-local-reports': 'enable',932 'gui-multicast-policy': 'enable',933 'gui-multiple-interface-policy': 'enable',934 'gui-multiple-utm-profiles': 'enable',935 'gui-nat46-64': 'enable',936 'gui-object-colors': 'enable',937 'gui-policy-based-ipsec': 'enable',938 'gui-policy-learning': 'enable',939 'gui-replacement-message-groups': 'enable',940 'gui-spamfilter': 'enable',941 'gui-sslvpn-personal-bookmarks': 'enable',942 'gui-sslvpn-realms': 'enable',943 'gui-switch-controller': 'enable',944 'gui-threat-weight': 'enable',945 'gui-traffic-shaping': 'enable',946 'gui-voip-profile': 'enable',947 'gui-vpn': 'enable',948 'gui-waf-profile': 'enable',949 'gui-wan-load-balancing': 'enable',950 'gui-wanopt-cache': 'enable',951 'gui-webfilter': 'enable',952 'gui-webfilter-advanced': 'enable',953 'gui-wireless-controller': 'enable',954 'http-external-dest': 'fortiweb',955 'ike-dn-format': 'with-space',956 'ike-quick-crash-detect': 'enable',957 'ike-session-resume': 'enable',958 'implicit-allow-dns': 'enable',959 'inspection-mode': 'proxy',960 'ip': 'test_value_84',961 'ip6': 'test_value_85',962 'link-down-access': 'enable',963 'lldp-transmission': 'enable',964 'mac-ttl': '88',965 'manageip': 'test_value_89',966 'manageip6': 'test_value_90',967 'multicast-forward': 'enable',968 'multicast-skip-policy': 'enable',969 'multicast-ttl-notchange': 'enable',970 'ngfw-mode': 'profile-based',971 'opmode': 'nat',972 'prp-trailer-action': 'enable',973 'sccp-port': '97',974 'ses-denied-traffic': 'enable',975 'sip-helper': 'enable',976 'sip-nat-trace': 'enable',977 'sip-ssl-port': '101',978 'sip-tcp-port': '102',979 'sip-udp-port': '103',980 'snat-hairpin-traffic': 'enable',981 'ssl-ssh-profile': 'test_value_105',982 'status': 'enable',983 'strict-src-check': 'enable',984 'tcp-session-without-syn': 'enable',985 'utf8-spam-tagging': 'enable',986 'v4-ecmp-mode': 'source-ip-based',987 'vpn-stats-log': 'ipsec',988 'vpn-stats-period': '112',989 'wccp-cache-engine': 'enable'990 }991 set_method_mock.assert_called_with('system', 'settings', data=expected_data, vdom='root')992 schema_method_mock.assert_not_called()993 assert not is_error994 assert changed995 assert response['status'] == 'success'...

Full Screen

Full Screen

test_docu_vieware_get_control_parameters.py

Source:test_docu_vieware_get_control_parameters.py Github

copy

Full Screen

1# coding: utf-82"""3 PassportPDF API4 Another brick in the cloud # noqa: E5015 The version of the OpenAPI document: 1.0.16 Generated by: https://openapi-generator.tech7"""8from __future__ import absolute_import9import unittest10import datetime11import openapi_client12from openapi_client.models.docu_vieware_get_control_parameters import DocuViewareGetControlParameters # noqa: E50113from openapi_client.rest import ApiException14class TestDocuViewareGetControlParameters(unittest.TestCase):15 """DocuViewareGetControlParameters unit test stubs"""16 def setUp(self):17 pass18 def tearDown(self):19 pass20 def make_instance(self, include_optional):21 """Test DocuViewareGetControlParameters22 include_option is a boolean, when False only required23 params are included, when True both required and24 optional params are included """25 # model = openapi_client.models.docu_vieware_get_control_parameters.DocuViewareGetControlParameters() # noqa: E50126 if include_optional :27 return DocuViewareGetControlParameters(28 session_id = '0', 29 control_state = openapi_client.models.docu_vieware_control_state.DocuViewareControlState(30 timeout = 56, 31 control_id = 'DocuVieware1', 32 show_logo = True, 33 remote_ip = '0', 34 file_hosting_uri = '0', 35 document_uri = '0', 36 document_file_name = '0', 37 disable_download_progress = True, 38 document_alignment = 'MiddleLeft', 39 document_position = 'MiddleLeft', 40 enable_gd_picture_annotations = True, 41 disable_annotation_printing = True, 42 enable_form_fields_edition = True, 43 annotation_editor_mode = True, 44 link_annotation_click_behaviour = 'Default', 45 zoom = 1.337, 46 zoom_mode = 'ZoomMode100', 47 open_zoom_mode = 'ZoomMode100', 48 view_rotation = 'RotateNoneFlipNone', 49 page_rotation = 'RotateNoneFlipNone', 50 zoom_step = 56, 51 scroll_bars = True, 52 force_scroll_bars = True, 53 page_view_mode = 'SinglePageView', 54 enable_text_selection = True, 55 enable_text_selection_annotation = True, 56 locale = 'Auto', 57 user_languages = [58 '0'59 ], 60 control_width = '100%', 61 control_height = '100%', 62 annotation_drop_shadow = True, 63 allow_print = True, 64 allow_upload = True, 65 enable_multiple_thumbnail_selection = True, 66 enable_thumbnail_drag_drop = True, 67 enable_file_upload_button = True, 68 enable_load_from_uri_button = True, 69 enable_save_button = True, 70 enable_pages_navigation_buttons = True, 71 enable_print_button = True, 72 enable_print_to_pdf = True, 73 enable_fit_width_button = True, 74 enable_zoom100_button = True, 75 enable_mouse_mode_buttons = True, 76 enable_pan_mode_button = True, 77 enable_select_mode_button = True, 78 enable_marquee_zoom_mode_button = True, 79 enable_full_screen_button = True, 80 enable_fit_page_button = True, 81 enable_zoom_buttons = True, 82 enable_page_view_buttons = True, 83 rotate_buttons_mode = 'View', 84 enable_rotate_buttons = True, 85 enable_annotation_action_buttons = True, 86 enable_selected_text_annotation_edition = True, 87 enable_rectangle_highlighter_annotation_button = True, 88 enable_freehand_highlighter_annotation_button = True, 89 enable_rubber_stamp_annotation_button = True, 90 enable_rectangle_annotation_button = True, 91 enable_ellipse_annotation_button = True, 92 enable_line_annotation_button = True, 93 enable_connected_line_annotation_button = True, 94 enable_freehand_annotation_button = True, 95 enable_line_arrow_annotation_button = True, 96 enable_link_annotation_button = True, 97 enable_ruler_annotation_button = True, 98 enable_poly_ruler_annotation_button = True, 99 enable_text_annotation_button = True, 100 enable_sticky_note_annotation_button = True, 101 enable_twain_acquisition_button = True, 102 twain_source_enable_custom_configuration = True, 103 twain_source_select_feeder = True, 104 twain_source_bit_depth = 56, 105 twain_source_resolution = 56, 106 twain_source_enable_duplex = True, 107 twain_source_hide_ui = True, 108 free_hand_continuous_drawing_mode = True, 109 show_text_search_snap_in = True, 110 show_thumbnails_snap_in = True, 111 show_bookmarks_snap_in = True, 112 show_annotations_snap_in = True, 113 show_annotations_comments_snap_in = True, 114 show_redaction_snap_in = True, 115 show_digital_signature_snap_in = True, 116 thumbnail_width = 56, 117 thumbnail_height = 56, 118 snap_in_panel_default_width = '280px', 119 collapsed_snap_in = True, 120 collapse_snapin_on_document_closed = True, 121 show_snap_in_collapse_button = True, 122 show_snap_in_panel_header = True, 123 show_snap_in_button_strip = True, 124 show_toolbar = True, 125 toolbar_style = 'Auto', 126 toolbar_buttons_spacing = 56, 127 toolbar_height = 56, 128 stroke_color = '#646464', 129 misc_border_color = '#DCDCDC', 130 header_color = '#213E4E', 131 panel_back_color = '#FFFFFF', 132 viewer_back_color = '#565656', 133 active_selected_color = '#0382D4', 134 toolbar_back_color = '#F2F2F2', 135 custom_notification_icon_error = '0', 136 custom_notification_icon_question = '0', 137 custom_notification_icon_warning = '0', 138 custom_notification_icon_info = '0', 139 custom_notification_icon_ok = '0', 140 allowed_export_formats = '*', 141 disable_annotation_drawing_mode_panel = True, 142 image_quality = 56, 143 print_quality = 'Low', 144 enable_documents_drop = True, 145 ajax_custom_headers = '0', 146 file_download_custom_headers = '0', 147 text_search_max_results = 56, 148 max_upload_size = 56, 149 max_download_size = 56, 150 max_pages = 56, 151 certificates = [152 openapi_client.models.docu_vieware_certificate.DocuViewareCertificate(153 display_name = '0', 154 data = 'YQ==', 155 password = '0', 156 timestamp_server_uri = '0', 157 timestamp_server_user_name = '0', 158 timestamp_server_user_password = '0', )159 ], 160 extra_features = '0', )161 )162 else :163 return DocuViewareGetControlParameters(164 session_id = '0',165 control_state = openapi_client.models.docu_vieware_control_state.DocuViewareControlState(166 timeout = 56, 167 control_id = 'DocuVieware1', 168 show_logo = True, 169 remote_ip = '0', 170 file_hosting_uri = '0', 171 document_uri = '0', 172 document_file_name = '0', 173 disable_download_progress = True, 174 document_alignment = 'MiddleLeft', 175 document_position = 'MiddleLeft', 176 enable_gd_picture_annotations = True, 177 disable_annotation_printing = True, 178 enable_form_fields_edition = True, 179 annotation_editor_mode = True, 180 link_annotation_click_behaviour = 'Default', 181 zoom = 1.337, 182 zoom_mode = 'ZoomMode100', 183 open_zoom_mode = 'ZoomMode100', 184 view_rotation = 'RotateNoneFlipNone', 185 page_rotation = 'RotateNoneFlipNone', 186 zoom_step = 56, 187 scroll_bars = True, 188 force_scroll_bars = True, 189 page_view_mode = 'SinglePageView', 190 enable_text_selection = True, 191 enable_text_selection_annotation = True, 192 locale = 'Auto', 193 user_languages = [194 '0'195 ], 196 control_width = '100%', 197 control_height = '100%', 198 annotation_drop_shadow = True, 199 allow_print = True, 200 allow_upload = True, 201 enable_multiple_thumbnail_selection = True, 202 enable_thumbnail_drag_drop = True, 203 enable_file_upload_button = True, 204 enable_load_from_uri_button = True, 205 enable_save_button = True, 206 enable_pages_navigation_buttons = True, 207 enable_print_button = True, 208 enable_print_to_pdf = True, 209 enable_fit_width_button = True, 210 enable_zoom100_button = True, 211 enable_mouse_mode_buttons = True, 212 enable_pan_mode_button = True, 213 enable_select_mode_button = True, 214 enable_marquee_zoom_mode_button = True, 215 enable_full_screen_button = True, 216 enable_fit_page_button = True, 217 enable_zoom_buttons = True, 218 enable_page_view_buttons = True, 219 rotate_buttons_mode = 'View', 220 enable_rotate_buttons = True, 221 enable_annotation_action_buttons = True, 222 enable_selected_text_annotation_edition = True, 223 enable_rectangle_highlighter_annotation_button = True, 224 enable_freehand_highlighter_annotation_button = True, 225 enable_rubber_stamp_annotation_button = True, 226 enable_rectangle_annotation_button = True, 227 enable_ellipse_annotation_button = True, 228 enable_line_annotation_button = True, 229 enable_connected_line_annotation_button = True, 230 enable_freehand_annotation_button = True, 231 enable_line_arrow_annotation_button = True, 232 enable_link_annotation_button = True, 233 enable_ruler_annotation_button = True, 234 enable_poly_ruler_annotation_button = True, 235 enable_text_annotation_button = True, 236 enable_sticky_note_annotation_button = True, 237 enable_twain_acquisition_button = True, 238 twain_source_enable_custom_configuration = True, 239 twain_source_select_feeder = True, 240 twain_source_bit_depth = 56, 241 twain_source_resolution = 56, 242 twain_source_enable_duplex = True, 243 twain_source_hide_ui = True, 244 free_hand_continuous_drawing_mode = True, 245 show_text_search_snap_in = True, 246 show_thumbnails_snap_in = True, 247 show_bookmarks_snap_in = True, 248 show_annotations_snap_in = True, 249 show_annotations_comments_snap_in = True, 250 show_redaction_snap_in = True, 251 show_digital_signature_snap_in = True, 252 thumbnail_width = 56, 253 thumbnail_height = 56, 254 snap_in_panel_default_width = '280px', 255 collapsed_snap_in = True, 256 collapse_snapin_on_document_closed = True, 257 show_snap_in_collapse_button = True, 258 show_snap_in_panel_header = True, 259 show_snap_in_button_strip = True, 260 show_toolbar = True, 261 toolbar_style = 'Auto', 262 toolbar_buttons_spacing = 56, 263 toolbar_height = 56, 264 stroke_color = '#646464', 265 misc_border_color = '#DCDCDC', 266 header_color = '#213E4E', 267 panel_back_color = '#FFFFFF', 268 viewer_back_color = '#565656', 269 active_selected_color = '#0382D4', 270 toolbar_back_color = '#F2F2F2', 271 custom_notification_icon_error = '0', 272 custom_notification_icon_question = '0', 273 custom_notification_icon_warning = '0', 274 custom_notification_icon_info = '0', 275 custom_notification_icon_ok = '0', 276 allowed_export_formats = '*', 277 disable_annotation_drawing_mode_panel = True, 278 image_quality = 56, 279 print_quality = 'Low', 280 enable_documents_drop = True, 281 ajax_custom_headers = '0', 282 file_download_custom_headers = '0', 283 text_search_max_results = 56, 284 max_upload_size = 56, 285 max_download_size = 56, 286 max_pages = 56, 287 certificates = [288 openapi_client.models.docu_vieware_certificate.DocuViewareCertificate(289 display_name = '0', 290 data = 'YQ==', 291 password = '0', 292 timestamp_server_uri = '0', 293 timestamp_server_user_name = '0', 294 timestamp_server_user_password = '0', )295 ], 296 extra_features = '0', ),297 )298 def testDocuViewareGetControlParameters(self):299 """Test DocuViewareGetControlParameters"""300 inst_req_only = self.make_instance(include_optional=False)301 inst_req_and_optional = self.make_instance(include_optional=True)302if __name__ == '__main__':...

Full Screen

Full Screen

old.configure

Source:old.configure Github

copy

Full Screen

1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-2# vim: set filetype=python:3# This Source Code Form is subject to the terms of the Mozilla Public4# License, v. 2.0. If a copy of the MPL was not distributed with this5# file, You can obtain one at http://mozilla.org/MPL/2.0/.6@imports('codecs')7@imports('sys')8def encoded_open(path, mode):9 encoding = 'mbcs' if sys.platform == 'win32' else 'utf-8'10 return codecs.open(path, mode, encoding)11option(env='AUTOCONF', nargs=1, help='Path to autoconf 2.13')12@depends(mozconfig, 'AUTOCONF')13@checking('for autoconf')14@imports(_from='os.path', _import='exists')15@imports('re')16def autoconf(mozconfig, autoconf):17 mozconfig_autoconf = None18 if mozconfig['path']:19 make_extra = mozconfig['make_extra']20 if make_extra:21 for assignment in make_extra:22 m = re.match('(?:export\s+)?AUTOCONF\s*:?=\s*(.+)$',23 assignment)24 if m:25 mozconfig_autoconf = m.group(1)26 autoconf = autoconf[0] if autoconf else None27 for ac in (mozconfig_autoconf, autoconf, 'autoconf-2.13', 'autoconf2.13',28 'autoconf213'):29 if ac:30 autoconf = find_program(ac)31 if autoconf:32 break33 else:34 fink = find_program('fink')35 if fink:36 autoconf = os.path.normpath(os.path.join(37 fink, '..', '..', 'lib', 'autoconf2.13', 'bin', 'autoconf'))38 else:39 brew = find_program('brew')40 if brew:41 autoconf = os.path.normpath(os.path.join(42 brew, '..', '..', 'Cellar', 'autoconf213', '2.13', 'bin',43 'autoconf213'))44 if not autoconf:45 die('Could not find autoconf 2.13')46 if not exists(autoconf):47 die('Could not find autoconf 2.13 at %s', autoconf)48 return autoconf49set_config('AUTOCONF', autoconf)50@depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell,51 old_configure_assignments, build_project)52@imports(_from='__builtin__', _import='open')53@imports(_from='__builtin__', _import='print')54@imports(_from='__builtin__', _import='sorted')55@imports('glob')56@imports('itertools')57@imports('subprocess')58# Import getmtime without overwriting the sandbox os.path.59@imports(_from='os.path', _import='getmtime')60@imports(_from='os.path', _import='exists')61@imports(_from='mozbuild.shellutil', _import='quote')62def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,63 old_configure_assignments, build_project):64 # os.path.abspath in the sandbox will ensure forward slashes on Windows,65 # which is actually necessary because this path actually ends up literally66 # as $0, and backslashes there breaks autoconf's detection of the source67 # directory.68 old_configure = os.path.abspath(old_configure[0])69 if build_project == 'js':70 old_configure_dir = os.path.dirname(old_configure)71 if not old_configure_dir.endswith('/js/src'):72 old_configure = os.path.join(old_configure_dir, 'js', 'src',73 os.path.basename(old_configure))74 refresh = True75 if exists(old_configure):76 mtime = getmtime(old_configure)77 aclocal = os.path.join(build_env.topsrcdir, 'build', 'autoconf',78 '*.m4')79 for input in itertools.chain(80 (old_configure + '.in',81 os.path.join(os.path.dirname(old_configure), 'aclocal.m4')),82 glob.iglob(aclocal),83 ):84 if getmtime(input) > mtime:85 break86 else:87 refresh = False88 if refresh:89 log.info('Refreshing %s with %s', old_configure, autoconf)90 script = subprocess.check_output([91 shell, autoconf,92 '--localdir=%s' % os.path.dirname(old_configure),93 old_configure + '.in'])94 if not script:95 die('Generated old-configure is empty! Check that your autoconf 2.13 program works!')96 # Make old-configure append to config.log, where we put our own log.97 # This could be done with a m4 macro, but it's way easier this way98 script = script.replace('>./config.log', '>>./config.log')99 with open(old_configure, 'wb') as fh:100 fh.write(script)101 cmd = [shell, old_configure]102 with encoded_open('old-configure.vars', 'w') as out:103 log.debug('Injecting the following to old-configure:')104 def inject(command):105 print(command, file=out) # noqa Python 2vs3106 log.debug('| %s', command)107 if mozconfig['path']:108 inject('# start of mozconfig values')109 items = {}110 for key, value in mozconfig['vars']['added'].items():111 items[key] = (value, 'added')112 for key, (old, value) in mozconfig['vars']['modified'].items():113 items[key] = (value, 'modified')114 for key, (value, action) in sorted(items.items()):115 inject("%s=%s # %s" % (key, quote(value), action))116 for t in ('env', 'vars'):117 for key in sorted(mozconfig[t]['removed'].keys()):118 inject("unset %s # from %s" % (key, t))119 inject('# end of mozconfig values')120 # Autoconf is special, because it might be passed from121 # mozconfig['make_extra'], which we don't pass automatically above.122 inject('export AUTOCONF=%s' % quote(autoconf))123 for assignment in old_configure_assignments:124 inject(assignment)125 return cmd126@template127def old_configure_options(*options):128 for opt in options:129 option(opt, nargs='*', help='Help missing for old configure options')130 @dependable131 def all_options():132 return list(options)133 return depends(prepare_configure, extra_old_configure_args, all_options,134 *options)135@old_configure_options(136 '--cache-file',137 '--datadir',138 '--enable-accessibility',139 '--enable-address-sanitizer',140 '--enable-alsa',141 '--enable-bundled-fonts',142 '--enable-content-sandbox',143 '--enable-cookies',144 '--enable-cpp-rtti',145 '--enable-crashreporter',146 '--enable-dbus',147 '--enable-debug-js-modules',148 '--enable-directshow',149 '--enable-dtrace',150 '--enable-dump-painting',151 '--enable-extensions',152 '--enable-faststripe',153 '--enable-feeds',154 '--enable-gamepad',155 '--enable-gconf',156 '--enable-hardware-aec-ns',157 '--enable-icf',158 '--enable-install-strip',159 '--enable-ios-target',160 '--enable-libjpeg-turbo',161 '--enable-libproxy',162 '--enable-llvm-hacks',163 '--enable-logrefcnt',164 '--enable-maintenance-service',165 '--enable-memory-sanitizer',166 '--enable-mobile-optimize',167 '--enable-necko-wifi',168 '--enable-negotiateauth',169 '--enable-nfc',170 '--enable-nspr-build',171 '--enable-official-branding',172 '--enable-oom-breakpoint',173 '--enable-parental-controls',174 '--enable-pie',175 '--enable-posix-nspr-emulation',176 '--enable-pref-extensions',177 '--enable-pulseaudio',178 '--enable-raw',179 '--enable-readline',180 '--enable-reflow-perf',181 '--enable-sandbox',182 '--enable-signmar',183 '--enable-small-chunk-size',184 '--enable-startup-notification',185 '--enable-startupcache',186 '--enable-stdcxx-compat',187 '--enable-strip',188 '--enable-synth-pico',189 '--enable-system-cairo',190 '--enable-system-extension-dirs',191 '--enable-system-pixman',192 '--enable-system-sqlite',193 '--enable-tasktracer',194 '--enable-thread-sanitizer',195 '--enable-ubsan-int-overflow',196 '--enable-ui-locale',197 '--enable-universalchardet',198 '--enable-updater',199 '--enable-valgrind',200 '--enable-verify-mar',201 '--enable-xul',202 '--enable-zipwriter',203 '--includedir',204 '--libdir',205 '--no-create',206 '--prefix',207 '--with-android-distribution-directory',208 '--with-android-max-sdk',209 '--with-android-min-sdk',210 '--with-android-sdk',211 '--with-app-basename',212 '--with-app-name',213 '--with-arch',214 '--with-branding',215 '--with-cross-lib',216 '--with-debug-label',217 '--with-distribution-id',218 '--with-doc-include-dirs',219 '--with-doc-input-dirs',220 '--with-doc-output-dir',221 '--with-float-abi',222 '--with-fpu',223 '--with-intl-api',224 '--with-ios-sdk',225 '--with-jitreport-granularity',226 '--with-macbundlename-prefix',227 '--with-macos-private-frameworks',228 '--with-macos-sdk',229 '--with-nspr-cflags',230 '--with-nspr-exec-prefix',231 '--with-nspr-libs',232 '--with-nspr-prefix',233 '--with-nss-exec-prefix',234 '--with-nss-prefix',235 '--with-pthreads',236 '--with-qemu-exe',237 '--with-sixgill',238 '--with-soft-float',239 '--with-system-bz2',240 '--with-system-icu',241 '--with-system-jpeg',242 '--with-system-libevent',243 '--with-system-libvpx',244 '--with-system-nspr',245 '--with-system-nss',246 '--with-system-png',247 '--with-system-zlib',248 '--with-thumb',249 '--with-thumb-interwork',250 '--with-unify-dist',251 '--with-user-appdir',252 '--x-includes',253 '--x-libraries',254)255@imports(_from='__builtin__', _import='compile')256@imports(_from='__builtin__', _import='open')257@imports('logging')258@imports('os')259@imports('subprocess')260@imports('sys')261@imports(_from='mozbuild.shellutil', _import='quote')262@imports(_from='mozbuild.shellutil', _import='split')263@imports(_from='mozbuild.util', _import='encode')264def old_configure(prepare_configure, extra_old_configure_args, all_options,265 *options):266 cmd = prepare_configure267 # old-configure only supports the options listed in @old_configure_options268 # so we don't need to pass it every single option we've been passed. Only269 # the ones that are not supported by python configure need to.270 cmd += [271 value.format(name)272 for name, value in zip(all_options, options)273 if value.origin != 'default'274 ]275 env = dict(os.environ)276 extra_env = {}277 # We also pass it the options from js/moz.configure so that it can pass278 # them down to js/src/configure. Note this list is empty when running279 # js/src/configure, in which case we don't need to pass those options280 # to old-configure since old-configure doesn't handle them anyways.281 if extra_old_configure_args:282 for arg in extra_old_configure_args:283 if arg.startswith('-'):284 cmd.append(arg)285 else:286 k, v = arg.split('=', 1)287 extra_env[k] = v288 if extra_env:289 env.update(extra_env)290 # For debugging purpose, in case it's not what we'd expect.291 log.debug('Running %s', quote(*cmd))292 if extra_env:293 log.debug('with extra environment: %s',294 ' '.join('%s=%s' % pair for pair in extra_env.iteritems()))295 # Our logging goes to config.log, the same file old.configure uses.296 # We can't share the handle on the file, so close it. We assume nothing297 # beyond this point is going to be interesting to log to config.log from298 # our end, so we don't make the effort to recreate a logging.FileHandler.299 logger = logging.getLogger('moz.configure')300 for handler in logger.handlers:301 if isinstance(handler, logging.FileHandler):302 handler.close()303 logger.removeHandler(handler)304 log_size = os.path.getsize('config.log')305 ret = subprocess.call(cmd, env=encode(env))306 if ret:307 with log.queue_debug():308 with encoded_open('config.log', 'r') as fh:309 fh.seek(log_size)310 for line in fh:311 log.debug(line.rstrip())312 log.error('old-configure failed')313 sys.exit(ret)314 raw_config = {315 'split': split,316 'unique_list': unique_list,317 }318 with encoded_open('config.data', 'r') as fh:319 code = compile(fh.read(), 'config.data', 'exec')320 # Every variation of the exec() function I tried led to:321 # SyntaxError: unqualified exec is not allowed in function 'main' it322 # contains a nested function with free variables323 exec code in raw_config # noqa324 # Ensure all the flags known to old-configure appear in the325 # @old_configure_options above.326 all_options = set(all_options)327 for flag in raw_config['flags']:328 if flag not in all_options:329 die('Missing option in `@old_configure_options` in %s: %s',330 __file__, flag)331 # If the code execution above fails, we want to keep the file around for332 # debugging.333 os.remove('config.data')334 return raw_config335# set_config is only available in the global namespace, not directly in336# @depends functions, but we do need to enumerate the result of337# old_configure, so we cheat.338@imports('__sandbox__')339def set_old_configure_config(name, value):340 __sandbox__.set_config_impl(name, value)341# Same as set_old_configure_config, but for set_define.342@imports('__sandbox__')343def set_old_configure_define(name, value):344 __sandbox__.set_define_impl(name, value)345@depends(old_configure)346@imports('types')347def post_old_configure(raw_config):348 for k, v in raw_config['substs']:349 set_old_configure_config(350 k[1:-1], v[1:-1] if isinstance(v, types.StringTypes) else v)351 for k, v in dict(raw_config['defines']).iteritems():352 set_old_configure_define(k[1:-1], v[1:-1])353 set_old_configure_config('non_global_defines',354 raw_config['non_global_defines'])355# Assuming no other option is declared after this function, handle the356# env options that were injected by mozconfig_options by creating dummy357# Option instances and having the sandbox's CommandLineHelper handle358# them. We only do so for options that haven't been declared so far,359# which should be a proxy for the options that old-configure handles360# and that we don't know anything about.361@depends('--help')362@imports('__sandbox__')363@imports(_from='mozbuild.configure.options', _import='Option')364def remaining_mozconfig_options(_):365 helper = __sandbox__._helper366 for arg in helper:367 if helper._origins[arg] != 'mozconfig':368 continue369 name = arg.split('=', 1)[0]370 if name.isupper() and name not in __sandbox__._options:371 option = Option(env=name, nargs='*', help=name)372 helper.handle(option)...

Full Screen

Full Screen

moz.configure

Source:moz.configure Github

copy

Full Screen

1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-2# vim: set filetype=python:3# This Source Code Form is subject to the terms of the Mozilla Public4# License, v. 2.0. If a copy of the MPL was not distributed with this5# file, You can obtain one at http://mozilla.org/MPL/2.0/.6# /!\ Use js_option() instead of option() in this file. /!\7# =========================================================8@depends(build_project, '--help')9def building_js(build_project, help):10 return build_project == 'js'11# Exception to the rule above: JS_STANDALONE is a special option that doesn't12# want the js_option treatment. When we're done merging js/src/configure and13# top-level configure, it can go away, although the JS_STANDALONE config14# will still need to be set depending on building_js above.15option(env='JS_STANDALONE', default=building_js,16 help='Reserved for internal use')17@depends('JS_STANDALONE')18def js_standalone(value):19 if value:20 return True21set_config('JS_STANDALONE', js_standalone)22set_define('JS_STANDALONE', js_standalone)23add_old_configure_assignment('JS_STANDALONE', js_standalone)24js_option('--disable-js-shell', default=building_js,25 help='Do not build the JS shell')26@depends('--disable-js-shell')27def js_disable_shell(value):28 if not value:29 return True30set_config('JS_DISABLE_SHELL', js_disable_shell)31set_define('JS_PUNBOX64', depends(target)(lambda t: t.bitness == 64 or None))32set_define('JS_NUNBOX32', depends(target)(lambda t: t.bitness == 32 or None))33# SpiderMonkey as a shared library, and how its symbols are exported34# ==================================================================35js_option('--disable-shared-js', default=building_js,36 help='Do not create a shared library')37js_option('--disable-export-js', default=building_js,38 help='Do not mark JS symbols as DLL exported/visible')39@depends('--disable-shared-js', '--disable-export-js')40def shared_js(shared_js, export_js):41 if shared_js:42 if not export_js:43 die('Must export JS symbols when building a shared library.')44 return True45set_config('JS_SHARED_LIBRARY', shared_js)46add_old_configure_assignment('JS_SHARED_LIBRARY', shared_js)47@depends('--disable-shared-js', '--disable-export-js')48def exportable_js_api(shared_js, export_js):49 if not shared_js and export_js:50 return True51set_define('STATIC_EXPORTABLE_JS_API', exportable_js_api)52@depends('--disable-shared-js', '--disable-export-js')53def static_js_api(shared_js, export_js):54 if not shared_js and not export_js:55 return True56set_define('STATIC_JS_API', static_js_api)57@depends('--disable-shared-js')58def static_js(value):59 if not value:60 return True61set_define('MOZ_STATIC_JS', static_js)62@deprecated_option(env='DISABLE_SHARED_JS', nargs='?')63def disable_shared_js(value):64 # DISABLE_SHARED_JS=1 gets us an empty PositiveOptionValue65 if value and not len(value):66 suggestion = '--disable-shared-js'67 else:68 suggestion = '--enable-shared-js'69 die('Setting %s is deprecated, use %s instead.',70 value.format('DISABLE_SHARED_JS'), suggestion)71@deprecated_option(env='DISABLE_EXPORT_JS', nargs='?')72def disable_export_js(value):73 # DISABLE_EXPORT_JS=1 gets us an empty PositiveOptionValue74 if value and not len(value):75 suggestion = '--disable-export-js'76 else:77 suggestion = '--enable-export-js'78 die('Setting %s is deprecated, use %s instead.',79 value.format('DISABLE_EXPORT_JS'), suggestion)80# JIT support81# =======================================================82@depends(target)83def ion_default(target):84 if target.cpu in ('x86', 'x86_64', 'arm', 'aarch64', 'mips32', 'mips64'):85 return True86js_option('--enable-ion',87 default=ion_default,88 help='Enable use of the IonMonkey JIT')89set_config('ENABLE_ION', depends_if('--enable-ion')(lambda x: True))90# JIT code simulator for cross compiles91# =======================================================92js_option('--enable-simulator', choices=('arm', 'arm64', 'mips32', 'mips64'),93 nargs=1,94 help='Enable a JIT code simulator for the specified architecture')95@depends('--enable-ion', '--enable-simulator', target)96def simulator(ion_enabled, simulator_enabled, target):97 if not ion_enabled or not simulator_enabled:98 return99 sim_cpu = simulator_enabled[0]100 if sim_cpu in ('arm', 'mips32'):101 if target.cpu != 'x86':102 die('The %s simulator only works on x86.' % sim_cpu)103 if sim_cpu in ('arm64', 'mips64'):104 if target.cpu != 'x86_64':105 die('The %s simulator only works on x86-64.' % sim_cpu)106 return namespace(**{sim_cpu: True})107set_config('JS_SIMULATOR', depends_if(simulator)(lambda x: True))108set_config('JS_SIMULATOR_ARM', simulator.arm)109set_config('JS_SIMULATOR_ARM64', simulator.arm64)110set_config('JS_SIMULATOR_MIPS32', simulator.mips32)111set_config('JS_SIMULATOR_MIPS64', simulator.mips64)112set_define('JS_SIMULATOR', depends_if(simulator)(lambda x: True))113set_define('JS_SIMULATOR_ARM', simulator.arm)114set_define('JS_SIMULATOR_ARM64', simulator.arm64)115set_define('JS_SIMULATOR_MIPS32', simulator.mips32)116set_define('JS_SIMULATOR_MIPS64', simulator.mips64)117@depends('--enable-ion', simulator, target)118def jit_codegen(ion_enabled, simulator, target):119 if not ion_enabled:120 return namespace(none=True)121 if simulator:122 return simulator123 if target.cpu == 'aarch64':124 return namespace(arm64=True)125 elif target.cpu == 'x86_64':126 return namespace(x64=True)127 return namespace(**{str(target.cpu): True})128set_config('JS_CODEGEN_NONE', jit_codegen.none)129set_config('JS_CODEGEN_ARM', jit_codegen.arm)130set_config('JS_CODEGEN_ARM64', jit_codegen.arm64)131set_config('JS_CODEGEN_MIPS32', jit_codegen.mips32)132set_config('JS_CODEGEN_MIPS64', jit_codegen.mips64)133set_config('JS_CODEGEN_X86', jit_codegen.x86)134set_config('JS_CODEGEN_X64', jit_codegen.x64)135set_define('JS_CODEGEN_NONE', jit_codegen.none)136set_define('JS_CODEGEN_ARM', jit_codegen.arm)137set_define('JS_CODEGEN_ARM64', jit_codegen.arm64)138set_define('JS_CODEGEN_MIPS32', jit_codegen.mips32)139set_define('JS_CODEGEN_MIPS64', jit_codegen.mips64)140set_define('JS_CODEGEN_X86', jit_codegen.x86)141set_define('JS_CODEGEN_X64', jit_codegen.x64)142@depends('--enable-ion', simulator, target, moz_debug)143def jit_disasm_arm(ion_enabled, simulator, target, debug):144 if not ion_enabled:145 return146 if simulator:147 if getattr(simulator, 'arm', None):148 return True149 if target.cpu == 'arm' and debug:150 return True151set_config('JS_DISASM_ARM', jit_disasm_arm)152set_define('JS_DISASM_ARM', jit_disasm_arm)153# Profiling154# =======================================================155js_option('--enable-instruments', env='MOZ_INSTRUMENTS',156 help='Enable instruments remote profiling')157@depends('--enable-instruments', target)158def instruments(value, target):159 if value and target.os != 'OSX':160 die('--enable-instruments cannot be used when targeting %s',161 target.os)162 if value:163 return True164set_config('MOZ_INSTRUMENTS', instruments)165set_define('MOZ_INSTRUMENTS', instruments)166add_old_configure_assignment('MOZ_INSTRUMENTS', instruments)167imply_option('--enable-profiling', instruments, reason='--enable-instruments')168js_option('--enable-callgrind', env='MOZ_CALLGRIND',169 help='Enable callgrind profiling')170@depends('--enable-callgrind')171def callgrind(value):172 if value:173 return True174set_define('MOZ_CALLGRIND', callgrind)175imply_option('--enable-profiling', callgrind)176@depends(milestone, '--help')177def enable_profiling(milestone, help):178 return milestone.is_nightly179js_option('--enable-profiling', env='MOZ_PROFILING', default=enable_profiling,180 help='Set compile flags necessary for using sampling profilers '181 '(e.g. shark, perf)')182@depends('--enable-profiling')183def profiling(value):184 if value:185 return True186add_old_configure_assignment('MOZ_PROFILING', profiling)187@depends(profiling, target)188def imply_vtune(value, target):189 ok_cpu = target.cpu in ['x86', 'x86_64']190 ok_kernel = target.kernel == 'WINNT' or \191 (target.kernel == 'Linux' and target.os == 'GNU')192 if value and ok_cpu and ok_kernel:193 return True194set_config('MOZ_PROFILING', profiling)195set_define('MOZ_PROFILING', profiling)196imply_option('--enable-vtune', imply_vtune, reason='--enable-profiling')197js_option('--enable-vtune', env='MOZ_VTUNE', help='Enable VTune profiling')198@depends('--enable-vtune')199def vtune(value):200 if value:201 return True202set_config('MOZ_VTUNE', vtune)203set_define('MOZ_VTUNE', vtune)204js_option('--enable-gc-trace', env='JS_GC_TRACE',205 help='Enable tracing of allocation and finalization')206@depends('--enable-gc-trace')207def gc_trace(value):208 if value:209 return True210set_define('JS_GC_TRACE', gc_trace)211js_option('--enable-gczeal',212 default=depends(when=moz_debug)(lambda: True),213 help='Enable zealous GCing')214set_define('JS_GC_ZEAL',215 depends_if('--enable-gczeal')(lambda _: True))216# Trace logging.217# =======================================================218js_option('--enable-trace-logging',219 default=depends(when=moz_debug)(lambda: True),220 help='Enable trace logging')221set_config('ENABLE_TRACE_LOGGING',222 depends_if('--enable-trace-logging')(lambda x: True))223set_define('JS_TRACE_LOGGING',224 depends_if('--enable-trace-logging')(lambda x: True))225js_option('--enable-perf', env='JS_ION_PERF',226 help='Enable Linux perf integration')227@depends('--enable-perf')228def ion_perf(value):229 if value:230 return True231set_define('JS_ION_PERF', ion_perf)232js_option('--enable-jitspew',233 default=depends(when=moz_debug)(lambda: True),234 help='Enable the Jit spew and IONFLAGS environment variable.')235set_define('JS_JITSPEW',236 depends_if('--enable-jitspew')(lambda _: True))237set_config('JS_JITSPEW',238 depends_if('--enable-jitspew')(lambda _: True))239js_option('--enable-more-deterministic', env='JS_MORE_DETERMINISTIC',240 help='Enable changes that make the shell more deterministic')241@depends('--enable-more-deterministic')242def more_deterministic(value):243 if value:244 return True245set_define('JS_MORE_DETERMINISTIC', more_deterministic)246# CTypes247# =======================================================248@depends(building_js, '--help')249def ctypes_default(building_js, _):250 return not building_js251js_option('--enable-ctypes', help='Enable js-ctypes',252 default=ctypes_default)253build_ctypes = depends_if('--enable-ctypes')(lambda _: True)254set_config('BUILD_CTYPES', build_ctypes)255set_define('BUILD_CTYPES', build_ctypes)256add_old_configure_assignment('BUILD_CTYPES', build_ctypes)257@depends(build_ctypes, building_js)258def js_has_ctypes(ctypes, js):259 if ctypes and js:260 return True261set_config('JS_HAS_CTYPES', js_has_ctypes)262set_define('JS_HAS_CTYPES', js_has_ctypes)263add_old_configure_assignment('JS_HAS_CTYPES', js_has_ctypes)264@depends('--enable-ctypes', '--enable-compile-environment', '--help')265def ctypes_and_compile_environment(ctypes, compile_environment, _):266 return ctypes and compile_environment267include('ffi.configure', when=ctypes_and_compile_environment)268# Support various fuzzing options269# ==============================================================270with only_when('--enable-compile-environment'):271 js_option('--enable-fuzzing', help='Enable fuzzing support')272 @depends('--enable-fuzzing')273 def enable_fuzzing(value):274 if value:275 return True276 @depends(try_compile(body='__AFL_COMPILER;',277 check_msg='for AFL compiler',278 when='--enable-fuzzing'))279 def enable_aflfuzzer(afl):280 if afl:281 return True282 @depends(enable_fuzzing,283 enable_aflfuzzer,284 c_compiler)285 def enable_libfuzzer(fuzzing, afl, c_compiler):286 if fuzzing and not afl and c_compiler.type == 'clang':287 return True288 @depends(enable_fuzzing,289 enable_aflfuzzer,290 enable_libfuzzer)291 def enable_fuzzing_interfaces(fuzzing, afl, libfuzzer):292 if fuzzing and (afl or libfuzzer):293 return True294 set_config('FUZZING', enable_fuzzing)295 set_define('FUZZING', enable_fuzzing)296 set_config('LIBFUZZER', enable_libfuzzer)297 set_define('LIBFUZZER', enable_libfuzzer)298 set_config('FUZZING_INTERFACES', enable_fuzzing_interfaces)299 set_define('FUZZING_INTERFACES', enable_fuzzing_interfaces)300# Enable pipeline operator301# ===================================================302js_option('--enable-pipeline-operator', default=False, help='Enable pipeline operator')303@depends('--enable-pipeline-operator')304def enable_pipeline_operator(value):305 if value:306 return True307set_config('ENABLE_PIPELINE_OPERATOR', enable_pipeline_operator)...

Full Screen

Full Screen

features.gypi

Source:features.gypi Github

copy

Full Screen

1#2# Copyright (C) 2009 Google Inc. All rights reserved.3# 4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions are6# met:7# 8# * Redistributions of source code must retain the above copyright9# notice, this list of conditions and the following disclaimer.10# * Redistributions in binary form must reproduce the above11# copyright notice, this list of conditions and the following disclaimer12# in the documentation and/or other materials provided with the13# distribution.14# * Neither the name of Google Inc. nor the names of its15# contributors may be used to endorse or promote products derived from16# this software without specific prior written permission.17# 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT24# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE28# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.29#30{31 # The following defines turn WebKit features on and off.32 'variables': {33 'feature_defines': [34 'ENABLE_3D_PLUGIN=1',35 'ENABLE_BATTERY_STATUS=0',36 'ENABLE_BLOB=1',37 'ENABLE_BLOB_SLICE=1',38 'ENABLE_CHANNEL_MESSAGING=1',39 'ENABLE_CSS_FILTERS=1',40 'ENABLE_CSS_IMAGE_SET=1',41 'ENABLE_CSS_SHADERS=1',42 'ENABLE_CSS_VARIABLES=0',43 'ENABLE_DATALIST=1',44 'ENABLE_DASHBOARD_SUPPORT=0',45 'ENABLE_DATA_TRANSFER_ITEMS=1',46 'ENABLE_DETAILS=1',47 'ENABLE_DEVICE_ORIENTATION=1',48 'ENABLE_DIRECTORY_UPLOAD=1',49 'ENABLE_DOWNLOAD_ATTRIBUTE=1',50 'ENABLE_ENCRYPTED_MEDIA=1',51 'ENABLE_FILE_SYSTEM=1',52 'ENABLE_FILTERS=1',53 'ENABLE_FULLSCREEN_API=1',54 'ENABLE_GAMEPAD=1',55 'ENABLE_GEOLOCATION=1',56 'ENABLE_GESTURE_EVENTS=1',57 'ENABLE_ICONDATABASE=0',58 'ENABLE_IFRAME_SEAMLESS=1',59 'ENABLE_INDEXED_DATABASE=1',60 'ENABLE_INPUT_SPEECH=1',61 'ENABLE_INPUT_TYPE_DATE=1',62 'ENABLE_INPUT_TYPE_DATETIME=0',63 'ENABLE_INPUT_TYPE_DATETIMELOCAL=0',64 'ENABLE_INPUT_TYPE_MONTH=0',65 'ENABLE_INPUT_TYPE_TIME=0',66 'ENABLE_INPUT_TYPE_WEEK=0',67 'ENABLE_JAVASCRIPT_DEBUGGER=1',68 'ENABLE_JAVASCRIPT_I18N_API=1',69 'ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0',70 'ENABLE_LEGACY_NOTIFICATIONS=1',71 'ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1',72 'ENABLE_LINK_PREFETCH=1',73 'ENABLE_LINK_PRERENDER=1',74 'ENABLE_MEDIA_SOURCE=1',75 'ENABLE_MEDIA_STATISTICS=1',76 'ENABLE_MEDIA_STREAM=1',77 'ENABLE_METER_TAG=1',78 'ENABLE_MHTML=1',79 'ENABLE_MICRODATA=0',80 'ENABLE_MUTATION_OBSERVERS=<(enable_mutation_observers)',81 'ENABLE_NOTIFICATIONS=1',82 'ENABLE_ORIENTATION_EVENTS=0',83 'ENABLE_OVERFLOW_SCROLLING=1',84 'ENABLE_PAGE_VISIBILITY_API=1',85 'ENABLE_POINTER_LOCK=1',86 'ENABLE_PROGRESS_TAG=1',87 'ENABLE_QUOTA=1',88 'ENABLE_REGISTER_PROTOCOL_HANDLER=1',89 'ENABLE_REQUEST_ANIMATION_FRAME=1',90 'ENABLE_RUBY=1',91 'ENABLE_SANDBOX=1',92 'ENABLE_SCRIPTED_SPEECH=1',93 'ENABLE_SHADOW_DOM=1',94 'ENABLE_SHARED_WORKERS=1',95 'ENABLE_SMOOTH_SCROLLING=1',96 'ENABLE_SQL_DATABASE=1',97 'ENABLE_STYLE_SCOPED=1',98 'ENABLE_SVG=<(enable_svg)',99 'ENABLE_SVG_FONTS=<(enable_svg)',100 'ENABLE_TOUCH_EVENTS=<(enable_touch_events)',101 'ENABLE_TOUCH_ICON_LOADING=<(enable_touch_icon_loading)',102 'ENABLE_V8_SCRIPT_DEBUG_SERVER=1',103 'ENABLE_VIDEO=1',104 'ENABLE_VIDEO_TRACK=1',105 'ENABLE_VIEWPORT=1',106 'ENABLE_WEBGL=1',107 'ENABLE_WEB_SOCKETS=1',108 'ENABLE_WEB_TIMING=1',109 'ENABLE_WORKERS=1',110 'ENABLE_XHR_RESPONSE_BLOB=1',111 'ENABLE_XSLT=1',112 'WTF_USE_LEVELDB=1',113 'WTF_USE_BUILTIN_UTF8_CODEC=1',114 # WTF_USE_DYNAMIC_ANNOTATIONS=1 may be defined in build/common.gypi115 # We can't define it here because it should be present only116 # in Debug or release_valgrind_build=1 builds.117 'WTF_USE_OPENTYPE_SANITIZER=1',118 'WTF_USE_RTL_SCROLLBAR=1',119 'WTF_USE_SKIA_TEXT=<(enable_skia_text)',120 'WTF_USE_WEBP=1',121 'WTF_USE_WEBKIT_IMAGE_DECODERS=1',122 ],123 # We have to nest variables inside variables so that they can be overridden124 # through GYP_DEFINES.125 'variables': {126 'use_accelerated_compositing%': 1,127 'enable_skia_text%': 1,128 'enable_svg%': 1,129 'enable_viewport%': 0,130 'enable_touch_events%': 1,131 'enable_touch_icon_loading%' : 0,132 'enable_mutation_observers%': 1,133 },134 'use_accelerated_compositing%': '<(use_accelerated_compositing)',135 'enable_skia_text%': '<(enable_skia_text)',136 'enable_svg%': '<(enable_svg)',137 'enable_touch_events%': '<(enable_touch_events)',138 'conditions': [139 ['OS=="android"', {140 'feature_defines': [141 'ENABLE_CALENDAR_PICKER=0',142 'ENABLE_MEDIA_CAPTURE=1',143 'ENABLE_PAGE_POPUP=0',144 'ENABLE_WEB_AUDIO=0',145 'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1',146 ],147 }, {148 'feature_defines': [149 'ENABLE_CALENDAR_PICKER=1',150 'ENABLE_MEDIA_CAPTURE=0',151 'ENABLE_PAGE_POPUP=1',152 'ENABLE_WEB_AUDIO=1',153 ],154 }],155 ['OS=="android" or chromeos==1', {156 'feature_defines': [157 'ENABLE_INPUT_TYPE_COLOR=0',158 ],159 }, {160 'feature_defines': [161 'ENABLE_INPUT_TYPE_COLOR=1',162 ],163 }],164 ['use_accelerated_compositing==1', {165 'feature_defines': [166 'WTF_USE_ACCELERATED_COMPOSITING=1',167 'ENABLE_3D_RENDERING=1',168 ],169 }],170 ['use_accelerated_compositing==1', {171 'feature_defines': [172 'ENABLE_ACCELERATED_2D_CANVAS=1',173 ],174 }],175 # Mac OS X uses Accelerate.framework FFT by default instead of FFmpeg.176 ['OS!="mac"', {177 'feature_defines': [178 'WTF_USE_WEBAUDIO_FFMPEG=1',179 ],180 }],181 ['enable_web_intents==1', {182 'feature_defines': [183 'ENABLE_WEB_INTENTS=1',184 ],185 }],186 ['enable_web_intents_tag==1', {187 'feature_defines': [188 'ENABLE_WEB_INTENTS_TAG=1',189 ],190 }],191 ['OS=="mac"', {192 'feature_defines': [193 'ENABLE_RUBBER_BANDING=1',194 'WTF_USE_SKIA_ON_MAC_CHROMIUM=1',195 ],196 }],197 ],198 },...

Full Screen

Full Screen

elemental_fremontcutbuilder.py

Source:elemental_fremontcutbuilder.py Github

copy

Full Screen

1#!/usr/bin/python2# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file3# for details. All rights reserved. Use of this source code is governed by a4# BSD-style license that can be found in the LICENSE file.5import database6import databasebuilder7import idlparser8import logging.config9import os.path10import sys11# TODO(antonm): most probably should go away or be autogenerated on IDLs roll.12DEFAULT_FEATURE_DEFINES = [13 # Enabled Chrome WebKit build.14 'ENABLE_3D_PLUGIN',15 'ENABLE_3D_RENDERING',16 'ENABLE_ACCELERATED_2D_CANVAS',17 'ENABLE_BATTERY_STATUS',18 'ENABLE_BLOB',19 'ENABLE_BLOB_SLICE',20 'ENABLE_CALENDAR_PICKER',21 'ENABLE_CHANNEL_MESSAGING',22 'ENABLE_CSS_FILTERS',23 'ENABLE_CSS_IMAGE_SET',24 'ENABLE_CSS_SHADERS',25 'ENABLE_DART',26 'ENABLE_DATA_TRANSFER_ITEMS',27 'ENABLE_DETAILS',28 'ENABLE_DEVICE_ORIENTATION',29 'ENABLE_DIRECTORY_UPLOAD',30 'ENABLE_DOWNLOAD_ATTRIBUTE',31 'ENABLE_ENCRYPTED_MEDIA',32 'ENABLE_FILE_SYSTEM',33 'ENABLE_FILTERS',34 'ENABLE_FULLSCREEN_API',35 'ENABLE_GAMEPAD',36 'ENABLE_GEOLOCATION',37 'ENABLE_GESTURE_EVENTS',38 'ENABLE_INDEXED_DATABASE',39 'ENABLE_INPUT_SPEECH',40 'ENABLE_INPUT_TYPE_COLOR',41 'ENABLE_INPUT_TYPE_DATE',42 'ENABLE_JAVASCRIPT_DEBUGGER',43 'ENABLE_JAVASCRIPT_I18N_API',44 'ENABLE_LEGACY_NOTIFICATIONS',45 'ENABLE_LINK_PREFETCH',46 'ENABLE_MEDIA_SOURCE',47 'ENABLE_MEDIA_STATISTICS',48 'ENABLE_MEDIA_STREAM',49 'ENABLE_METER_TAG',50 'ENABLE_MHTML',51 'ENABLE_MUTATION_OBSERVERS',52 'ENABLE_NOTIFICATIONS',53 'ENABLE_OVERFLOW_SCROLLING',54 'ENABLE_PAGE_POPUP',55 'ENABLE_PAGE_VISIBILITY_API',56 'ENABLE_POINTER_LOCK',57 'ENABLE_PROGRESS_TAG',58 'ENABLE_QUOTA',59 'ENABLE_REGISTER_PROTOCOL_HANDLER',60 'ENABLE_REQUEST_ANIMATION_FRAME',61 'ENABLE_RUBY',62 'ENABLE_SANDBOX',63 'ENABLE_SCRIPTED_SPEECH',64 'ENABLE_SHADOW_DOM',65 'ENABLE_SHARED_WORKERS',66 'ENABLE_SMOOTH_SCROLLING',67 'ENABLE_SQL_DATABASE',68 'ENABLE_STYLE_SCOPED',69 'ENABLE_SVG',70 'ENABLE_SVG_FONTS',71 'ENABLE_TOUCH_EVENTS',72 'ENABLE_V8_SCRIPT_DEBUG_SERVER',73 'ENABLE_VIDEO',74 'ENABLE_VIDEO_TRACK',75 'ENABLE_VIEWPORT',76 'ENABLE_WEBGL',77 'ENABLE_WEB_AUDIO',78 'ENABLE_WEB_INTENTS',79 'ENABLE_WEB_SOCKETS',80 'ENABLE_WEB_TIMING',81 'ENABLE_WORKERS',82 'ENABLE_XHR_RESPONSE_BLOB',83 'ENABLE_XSLT',84]85# TODO(antonm): Remove this filter.86UNSUPPORTED_FEATURES = [ 'ENABLE_WEB_INTENTS' ]87def build_database(idl_files, database_dir, feature_defines = None):88 """This code reconstructs the FremontCut IDL database from W3C,89 WebKit and Dart IDL files."""90 current_dir = os.path.dirname(__file__)91 logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))92 db = database.Database(database_dir)93 # Delete all existing IDLs in the DB.94 db.Delete()95 builder = databasebuilder.DatabaseBuilder(db)96 # TODO(vsm): Move this to a README.97 # This is the Dart SVN revision.98 webkit_revision = '1060'99 # TODO(vsm): Reconcile what is exposed here and inside WebKit code100 # generation. We need to recheck this periodically for now.101 webkit_defines = [ 'LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT' ]102 if feature_defines is None:103 feature_defines = DEFAULT_FEATURE_DEFINES104 webkit_options = databasebuilder.DatabaseBuilderOptions(105 idl_syntax=idlparser.WEBKIT_SYNTAX,106# TODO(vsm): What else should we define as on when processing IDL?107 idl_defines=[define for define in webkit_defines + feature_defines if define not in UNSUPPORTED_FEATURES],108 source='WebKit',109 source_attributes={'revision': webkit_revision},110 type_rename_map={111 'BarInfo': 'BarProp',112 'DedicatedWorkerContext': 'DedicatedWorkerGlobalScope',113 'DOMApplicationCache': 'ApplicationCache',114 'DOMCoreException': 'DOMException',115 'DOMFormData': 'FormData',116 'DOMSelection': 'Selection',117 'DOMWindow': 'Window',118 'SharedWorkerContext': 'SharedWorkerGlobalScope',119 'WorkerContext': 'WorkerGlobalScope',120 })121 optional_argument_whitelist = [122 ('CSSStyleDeclaration', 'setProperty', 'priority'),123 ('IDBDatabase', 'transaction', 'mode'),124 ]125 # Import WebKit IDLs.126 for file_name in idl_files:127 builder.import_idl_file(file_name, webkit_options)128 # Import Dart idl:129 dart_options = databasebuilder.DatabaseBuilderOptions(130 idl_syntax=idlparser.FREMONTCUT_SYNTAX,131 source='Dart',132 rename_operation_arguments_on_merge=True)133 builder.import_idl_file(134 os.path.join(current_dir, '..', 'elemental', 'elemental.idl'),135 dart_options)136 # Merging:137 builder.merge_imported_interfaces(optional_argument_whitelist)138 builder.fix_displacements('WebKit')139 # Cleanup:140 builder.normalize_annotations(['WebKit', 'Dart'])141 db.Save()142def main():143 current_dir = os.path.dirname(__file__)144 webkit_dirs = [145 'css',146 'dom',147 'fileapi',148 'html',149 'html/canvas',150 'inspector',151 'loader',152 'loader/appcache',153 'Modules/battery',154 'Modules/filesystem',155 'Modules/geolocation',156 'Modules/indexeddb',157 'Modules/mediastream',158 'Modules/speech',159 'Modules/webaudio',160 'Modules/webdatabase',161 'Modules/websockets',162 'notifications',163 'page',164 'plugins',165 'storage',166 'svg',167 'workers',168 'xml',169 ]170 ignored_idls = [171 'AbstractView.idl',172 ]173 idl_files = []174 webcore_dir = os.path.join(current_dir, '..', 175 'third_party', 'WebCore')176 if not os.path.exists(webcore_dir):177 raise RuntimeError('directory not found: %s' % webcore_dir)178 def visitor(arg, dir_name, names):179 for name in names:180 file_name = os.path.join(dir_name, name)181 (interface, ext) = os.path.splitext(file_name)182 if ext == '.idl' and name not in ignored_idls:183 idl_files.append(file_name)184 for dir_name in webkit_dirs:185 dir_path = os.path.join(webcore_dir, dir_name)186 os.path.walk(dir_path, visitor, None)187 database_dir = os.path.join(current_dir, '..', 'database')188 return build_database(idl_files, database_dir)189if __name__ == '__main__':...

Full Screen

Full Screen

manager.py

Source:manager.py Github

copy

Full Screen

1"""2DEPRECATED:3Use `prompt_toolkit.key_binding.defaults.load_key_bindings` instead.4:class:`KeyBindingManager` is a utility (or shortcut) for loading all the key5bindings in a key binding registry, with a logic set of filters to quickly to6quickly change from Vi to Emacs key bindings at runtime.7You don't have to use this, but it's practical.8Usage::9 manager = KeyBindingManager()10 app = Application(key_bindings_registry=manager.registry)11"""12from __future__ import unicode_literals13from .defaults import load_key_bindings14from prompt_toolkit.filters import to_cli_filter15from prompt_toolkit.key_binding.registry import Registry, ConditionalRegistry, MergedRegistry16__all__ = (17 'KeyBindingManager',18)19class KeyBindingManager(object):20 """21 Utility for loading all key bindings into memory.22 :param registry: Optional `Registry` instance.23 :param enable_abort_and_exit_bindings: Filter to enable Ctrl-C and Ctrl-D.24 :param enable_system_bindings: Filter to enable the system bindings25 (meta-! prompt and Control-Z suspension.)26 :param enable_search: Filter to enable the search bindings.27 :param enable_open_in_editor: Filter to enable open-in-editor.28 :param enable_open_in_editor: Filter to enable open-in-editor.29 :param enable_extra_page_navigation: Filter for enabling extra page navigation.30 (Bindings for up/down scrolling through long pages, like in Emacs or Vi.)31 :param enable_auto_suggest_bindings: Filter to enable fish-style suggestions.32 :param enable_vi_mode: Deprecated!33 """34 def __init__(self,35 registry=None, # XXX: not used anymore.36 enable_vi_mode=None, # (`enable_vi_mode` is deprecated.)37 enable_all=True, #38 get_search_state=None,39 enable_abort_and_exit_bindings=False,40 enable_system_bindings=False,41 enable_search=False,42 enable_open_in_editor=False,43 enable_extra_page_navigation=False,44 enable_auto_suggest_bindings=False):45 assert registry is None or isinstance(registry, Registry)46 assert get_search_state is None or callable(get_search_state)47 enable_all = to_cli_filter(enable_all)48 defaults = load_key_bindings(49 get_search_state=get_search_state,50 enable_abort_and_exit_bindings=enable_abort_and_exit_bindings,51 enable_system_bindings=enable_system_bindings,52 enable_search=enable_search,53 enable_open_in_editor=enable_open_in_editor,54 enable_extra_page_navigation=enable_extra_page_navigation,55 enable_auto_suggest_bindings=enable_auto_suggest_bindings)56 # Note, we wrap this whole thing again in a MergedRegistry, because we57 # don't want the `enable_all` settings to apply on items that were58 # added to the registry as a whole.59 self.registry = MergedRegistry([60 ConditionalRegistry(defaults, enable_all)61 ])62 @classmethod63 def for_prompt(cls, **kw):64 """65 Create a ``KeyBindingManager`` with the defaults for an input prompt.66 This activates the key bindings for abort/exit (Ctrl-C/Ctrl-D),67 incremental search and auto suggestions.68 (Not for full screen applications.)69 """70 kw.setdefault('enable_abort_and_exit_bindings', True)71 kw.setdefault('enable_search', True)72 kw.setdefault('enable_auto_suggest_bindings', True)73 return cls(**kw)74 def reset(self, cli):75 # For backwards compatibility.76 pass77 def get_vi_state(self, cli):78 # Deprecated!...

Full Screen

Full Screen

imm.configure

Source:imm.configure Github

copy

Full Screen

1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-2# vim: set filetype=python:3# This Source Code Form is subject to the terms of the Mozilla Public4# License, v. 2.0. If a copy of the MPL was not distributed with this5# file, You can obtain one at http://mozilla.org/MPL/2.0/.6imply_option('--enable-foo', True)7option('--enable-foo', help='enable foo')8@depends('--enable-foo', '--help')9def foo(value, help):10 if value:11 return True12imply_option('--enable-bar', ('foo', 'bar'))13option('--enable-bar', nargs='*', help='enable bar')14@depends('--enable-bar')15def bar(value):16 if value:17 return value18imply_option('--enable-baz', 'BAZ')19option('--enable-baz', nargs=1, help='enable baz')20@depends('--enable-baz')21def bar(value):22 if value:...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const differencify = require('differencify');2differencify.enableForSuite();3const differencify = require('differencify');4differencify.disableForSuite();5const differencify = require('differencify');6differencify.enableForTest();7const differencify = require('differencify');8differencify.disableForTest();9const differencify = require('differencify');10differencify.enable();11const differencify = require('differencify');12differencify.disable();13const differencify = require('differencify');14differencify.enableForSuite();15const differencify = require('differencify');16differencify.disableForSuite();17const differencify = require('differencify');18differencify.enableForTest();19const differencify = require('differencify');20differencify.disableForTest();21const differencify = require('differencify');22differencify.enable();23const differencify = require('differencify');24differencify.disable();25const differencify = require('differencify');26differencify.enableForSuite();27const differencify = require('differencify');28differencify.disableForSuite();29const differencify = require('differencify');30differencify.enableForTest();31const differencify = require('differencify');32differencify.disableForTest();33const differencify = require('differenc

Full Screen

Using AI Code Generation

copy

Full Screen

1var differencify = require('differencify').init({autoSaveBaseline: true});2describe('differencify', function() {3 before(differencify.beforeHook);4 after(differencify.afterHook);5 it('should take a screenshot', function() {6 }]);7 });8});

Full Screen

Using AI Code Generation

copy

Full Screen

1const differencify = require('differencify');2differencify.init(browser, { autoSaveBaseline: true, autoSaveDiff: true });3describe('visual testing', () => {4 it('should match the baseline', () => {5 browser.saveFullPageScreen('google', { /* some options */ });6 });7});

Full Screen

Using AI Code Generation

copy

Full Screen

1var differencify = require('differencify');2var assert = require('assert');3describe('test', function () {4 it('should take a screenshot', function () {5 var screenshot = browser.screenshot();6 differencify.enableForSuite();7 assert.ok(differencify.check(screenshot, 'google'));8 });9});10### differencify.check(image, name, options)11it('should take a screenshot', function () {12 var screenshot = browser.screenshot();13 assert.ok(differencify.check(screenshot, 'google'));14});15### differencify.enableForSuite()16describe('test', function () {17 it('should take a screenshot', function () {18 var screenshot = browser.screenshot();19 differencify.enableForSuite();20 assert.ok(differencify.check(screenshot, 'google'));21 });22});23### differencify.enableForTest()24describe('test', function () {25 it('should take a screenshot', function () {26 var screenshot = browser.screenshot();27 differencify.enableForTest();28 assert.ok(differencify.check(screenshot, 'google'));29 });30});31### differencify.disable()32describe('test', function () {33 it('should take a screenshot', function () {34 var screenshot = browser.screenshot();35 differencify.disable();36 assert.ok(differencify.check(screenshot, 'google'));37 });38});39differencify.config = {40};41Default: `process.cwd()`

Full Screen

Using AI Code Generation

copy

Full Screen

1var differencify = require('differencify');2var assert = require('assert');3describe('test', function () {4 it('should take a screenshot', function () {5 var screenshot = browser.screenshot();6 differencify.enableForSuite();7 assert.ok(differencify.check(screenshot, 'google'));8 });9});10### differencify.check(image, name, options)11- `name` - name umar](

Full Screen

Using AI Code Generation

copy

Full Screen

1const {enable} = require('differencify');2enable();3it('should take screenshot', async () => {4 const title = await browser.getTitle();5 await browser.saveScreen(title);6});7const {enable} = require('differencify');8enable();9it('should take screenshot', async () => {10 const title = await browser.getTitle();11 await browser.saveScreen(title);12});13const {enable} = require('differencify');14enable();15it('should take screenshot', async () => {16 const title = await browser.getTitle();17 await browser.saveScreen(title);18});19const {enable} = require('differencify');20enable();21it('should take screenshot', async () => {22 const title = await browser.getTitle();23 await browser.saveScreen(title);24});25import {enable} from 'differencify';26enable();27it('should take screenshot', async () => {28 const title = await browser.getTitle();29 await browser.saveScreen(title);30import {enable} from 'differencify';31enable();32it('should take screenshot', async () => {33 const title = await browser.getTitle();34 await browser.saveconst { join } = reqoire('path');

Full Screen

Using AI Code Generation

copy

Full Screen

1const differencify = require("differencify");2const { enable } = differencify();3enable();4const { expect } = require("@playwright/test");5test("Test", async ({ page }) => {6 await page.screenshot({ path: "screenshots/google.png" });7 const image = await page.screenshot();8 expect(image).toMatchSnapshot("google.png");9}); screenshot10it('should take a screenshot', function () {11 var screenshot = browser.screenshot();12 assert.ok(differencify.check(screenshot, 'google'));13});14### differencify.enableForSuite()15describe('test', function () {16 it('should take a screenshot', function () {17 var screenshot = browser.screenshot();18 differencify.enableForSuite();19 assert.ok(differencify.check(screenshot, 'google'));20 });21});22### differencify.enableForTest()23describe('test', function () {24 it('should take a screenshot', function () {25 var screenshot = browser.screenshot();26 differencify.enableForTest();27 assert.ok(differencify.check(screenshot, 'google'));28 });29});30### differencify.disable()31describe('test', function () {32 it('should take a screenshot', function () {33 var screenshot = browser.screenshot();34 differencify.disable();35 assert.ok(differencify.check(screenshot, 'google'));36 });37});38differencify.config = {39};40Default: `process.cwd()`

Full Screen

Using AI Code Generation

copy

Full Screen

1const { enable, disable } = require('differencify');2enable();3disable();4### `enable()`5### `disable()`6MIT © [Saurabh Kumar](

Full Screen

Using AI Code Generation

copy

Full Screen

1const differencify = require("differencify");2const { enable } = differencify();3enable();4const { expect } = require("@playwright/test");5test("Test", async ({ page }) => {6 await page.screenshot({ path: "screenshots/google.png" });7 const image = await page.screenshot();8 expect(image).toMatchSnapshot("google.png");9});

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run differencify automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful