Python hamcrest.none() Examples
The following are 30
code examples of hamcrest.none().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
hamcrest
, or try the search function
.
Example #1
Source File: test_replication_interface.py From storops with Apache License 2.0 | 6 votes |
def test_get_properties(self): ri = replication_interface.UnityReplicationInterface.get( cli=mock.t_rest(), _id='if_10') hc.assert_that(ri.gateway, hc.equal_to('10.245.47.1')) hc.assert_that(ri.health, hc.instance_of(health.UnityHealth)) hc.assert_that(ri.health.value, hc.equal_to(storops.HealthEnum.OK)) hc.assert_that(ri.id, hc.equal_to('if_10')) hc.assert_that(ri.ip_address, hc.equal_to('10.245.47.99')) hc.assert_that(ri.ip_port, hc.instance_of(port.UnityIpPort)) hc.assert_that(ri.ip_port.id, hc.equal_to('spa_eth2')) hc.assert_that(ri.ip_protocol_version, hc.equal_to(storops.IpProtocolVersionEnum.IPv4)) hc.assert_that(ri.mac_address, hc.equal_to('00:60:16:5C:07:0B')) hc.assert_that(ri.name, hc.equal_to('4_FNM00150600267')) hc.assert_that(ri.netmask, hc.equal_to('255.255.255.0')) hc.assert_that(ri.v6_prefix_length, hc.none()) hc.assert_that(ri.vlan_id, hc.none())
Example #2
Source File: test_parsers.py From storops with Apache License 2.0 | 6 votes |
def test_parse(self): output = MockCli.read_file('lun_-list_-all_-l_19.txt') parser = get_vnx_parser('VNXLun') parsed = parser.parse(output) wwn = '60:06:01:60:1A:50:35:00:CC:22:61:D6:76:B1:E4:11' assert_that(parsed.wwn, equal_to(wwn)) assert_that(parsed.name, equal_to('test_lun')) assert_that(parsed.lun_id, equal_to(19)) assert_that(parsed.total_capacity_gb, equal_to(1.0)) assert_that(parsed.is_thin_lun, equal_to(True)) assert_that(parsed.is_compressed, equal_to(False)) assert_that(parsed.deduplication_state, equal_to('Off')) assert_that(parsed.tiering_policy, equal_to('No Movement')) assert_that(parsed.initial_tier, equal_to('Optimize Pool')) assert_that(parsed.state, equal_to('Ready')) assert_that(parsed.status, equal_to('OK(0x0)')) assert_that(parsed.operation, equal_to('None')) assert_that(parsed.current_owner, equal_to(VNXSPEnum.SP_A)) assert_that(parsed.attached_snapshot, none())
Example #3
Source File: test_parsers.py From storops with Apache License 2.0 | 6 votes |
def test_parse(self): output = """ ID: test Prop A (Name): ab (c) Prop B: d ef """ parser = DemoParser() parsed = parser.parse(output, [A, ID, C]) assert_that(parsed.prop_a, equal_to('ab (c)')) assert_that(parsed.prop_c, none()) assert_that(parsed.id, equal_to('test')) def f(): log.debug(parsed.prop_b) assert_that(f, raises(AttributeError))
Example #4
Source File: cisco_test.py From netman with Apache License 2.0 | 6 votes |
def test_set_bond_trunk_mode_idempotent(self): self.mocked_ssh_client.should_receive("do").with_args("show running-config interface Port-channel4").once().ordered().and_return([ "Building configuration...", "Current configuration : 156 bytes", "!", "interface Port-channel4", " switchport trunk allowed vlan 2999", " switchport mode trunk", "end" ]) self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").never() self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([ "Enter configuration commands, one per line. End with CNTL/Z." ]) self.mocked_ssh_client.should_receive("do").with_args("interface Port-channel4").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered() self.switch.set_bond_trunk_mode(4)
Example #5
Source File: cisco_test.py From netman with Apache License 2.0 | 6 votes |
def test_set_bond_trunk_mode_switching_mode(self): self.mocked_ssh_client.should_receive("do").with_args("show running-config interface Port-channel4").once().ordered().and_return([ "Building configuration...", "Current configuration : 156 bytes", "!", "interface Port-channel4", " switchport mode access", "end" ]) self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([ "Enter configuration commands, one per line. End with CNTL/Z." ]) self.mocked_ssh_client.should_receive("do").with_args("interface Port-channel4").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered() self.switch.set_bond_trunk_mode(4)
Example #6
Source File: cisco_test.py From netman with Apache License 2.0 | 6 votes |
def test_set_trunk_mode_idempotent(self): self.mocked_ssh_client.should_receive("do").with_args("show running-config interface FastEthernet0/4").once().ordered().and_return([ "Building configuration...", "Current configuration : 156 bytes", "!", "interface FastEthernet0/4", " switchport trunk allowed vlan 2999", " switchport mode trunk", "end" ]) self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").never() self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([ "Enter configuration commands, one per line. End with CNTL/Z." ]) self.mocked_ssh_client.should_receive("do").with_args("interface FastEthernet0/4").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered() self.switch.set_trunk_mode("FastEthernet0/4")
Example #7
Source File: cisco_test.py From netman with Apache License 2.0 | 6 votes |
def test_set_trunk_mode_switching_mode(self): self.mocked_ssh_client.should_receive("do").with_args("show running-config interface FastEthernet0/4").once().ordered().and_return([ "Building configuration...", "Current configuration : 156 bytes", "!", "interface FastEthernet0/4", " switchport mode access", "end" ]) self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([ "Enter configuration commands, one per line. End with CNTL/Z." ]) self.mocked_ssh_client.should_receive("do").with_args("interface FastEthernet0/4").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered() self.switch.set_trunk_mode("FastEthernet0/4")
Example #8
Source File: cisco_test.py From netman with Apache License 2.0 | 6 votes |
def test_set_trunk_mode_initial(self): self.mocked_ssh_client.should_receive("do").with_args("show running-config interface FastEthernet0/4").once().ordered().and_return([ "Building configuration...", "Current configuration : 156 bytes", "!", "interface FastEthernet0/4", "end" ]) self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([ "Enter configuration commands, one per line. End with CNTL/Z." ]) self.mocked_ssh_client.should_receive("do").with_args("interface FastEthernet0/4").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered() self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered() self.switch.set_trunk_mode("FastEthernet0/4")
Example #9
Source File: cisco_test.py From netman with Apache License 2.0 | 6 votes |
def parse_range_test(self): result = parse_vlan_ranges(None) assert_that(list(result), equal_to(range(1, 4094))) result = parse_vlan_ranges("none") assert_that(list(result), equal_to([])) result = parse_vlan_ranges("1") assert_that(list(result), equal_to([1])) result = parse_vlan_ranges("2-5") assert_that(list(result), equal_to([2, 3, 4, 5])) result = parse_vlan_ranges("1,3-5,7") assert_that(list(result), equal_to([1, 3, 4, 5, 7]))
Example #10
Source File: cisco_test.py From netman with Apache License 2.0 | 6 votes |
def test_get_vlan_with_an_empty_interface(self): self.mocked_ssh_client.should_receive("do").with_args("show running-config vlan 1750 | begin vlan").and_return([ "vlan 1750", " name Shizzle", "end" ]) self.mocked_ssh_client.should_receive("do").with_args("show running-config interface vlan 1750 | begin interface").once().ordered().and_return([ "interface Vlan1750", " no ip address" "end" ]) vlan = self.switch.get_vlan(1750) assert_that(vlan.number, is_(1750)) assert_that(vlan.name, is_("Shizzle")) assert_that(vlan.access_groups[IN], is_(none())) assert_that(vlan.access_groups[OUT], is_(none())) assert_that(vlan.vrf_forwarding, is_(none())) assert_that(vlan.ips, is_(empty())) assert_that(vlan.vrrp_groups, is_(empty())) assert_that(vlan.dhcp_relay_servers, is_(empty())) assert_that(vlan.unicast_rpf_mode, is_(None)) assert_that(vlan.arp_routing, is_(True))
Example #11
Source File: brocade_test.py From netman with Apache License 2.0 | 6 votes |
def test_get_vlan_with_an_empty_interface(self): self.shell_mock.should_receive("do").with_args("show vlan 1750").once().ordered().and_return( vlan_with_vif_display(1750, 999, name="Shizzle") ) self.shell_mock.should_receive("do").with_args("show running-config interface ve 999").once().ordered().and_return([ "interface ve 999", "!", ]) vlan = self.switch.get_vlan(1750) assert_that(vlan.number, is_(1750)) assert_that(vlan.name, is_("Shizzle")) assert_that(vlan.access_groups[IN], is_(none())) assert_that(vlan.access_groups[OUT], is_(none())) assert_that(vlan.vrf_forwarding, is_(none())) assert_that(vlan.ips, is_(empty())) assert_that(vlan.vrrp_groups, is_(empty())) assert_that(vlan.dhcp_relay_servers, is_(empty()))
Example #12
Source File: test_remote_system.py From storops with Apache License 2.0 | 6 votes |
def test_get_properties(self): rs = remote_system.UnityRemoteSystem.get(cli=mock.t_rest(), _id='RS_0') hc.assert_that(rs.alt_management_address_list, hc.none()) hc.assert_that(rs.connection_type, hc.equal_to(storops.ReplicationCapabilityEnum.ASYNC)) hc.assert_that(rs.health, hc.instance_of(health.UnityHealth)) hc.assert_that(rs.health.value, hc.equal_to(storops.HealthEnum.OK)) hc.assert_that(rs.id, hc.equal_to('RS_0')) hc.assert_that(rs.local_spa_interfaces, hc.equal_to(['128.221.255.12'])) hc.assert_that(rs.local_spb_interfaces, hc.equal_to(['128.221.255.13'])) hc.assert_that(rs.management_address, hc.equal_to('10.245.101.39')) hc.assert_that(rs.model, hc.equal_to('Unity 500')) hc.assert_that(rs.name, hc.equal_to('FNM00150600267')) hc.assert_that(rs.remote_spa_interfaces, hc.equal_to(['128.221.255.12'])) hc.assert_that(rs.remote_spb_interfaces, hc.equal_to(['128.221.255.13'])) hc.assert_that(rs.serial_number, hc.equal_to('FNM00150600267')) hc.assert_that(rs.sync_fc_ports, hc.equal_to(['spa_fc4', 'spb_fc4'])) hc.assert_that(rs.username, hc.equal_to('admin'))
Example #13
Source File: test_port.py From storops with Apache License 2.0 | 6 votes |
def test_create_delete_iscsi_ip(vnx_gf): sp, port_id = vnx_gf.select_port() port = vnx_gf.vnx.get_iscsi_port(sp, port_id)[0] # create ip port1 = port.config_ip('5.5.5.5', '255.255.255.0', '5.5.5.1', 1, 1) vnx_gf.until_existed(port1) assert_that(port1.ip_address, equal_to('5.5.5.5')) assert_that(port1.subnet_mask, equal_to('255.255.255.0')) assert_that(port1.gateway_address, equal_to('5.5.5.1')) # delete ip port1.delete_ip() vnx_gf.until_not_existed(port1) port = vnx_gf.vnx.get_iscsi_port(sp, port_id)[0] assert_that(port.ip_address, none()) assert_that(port.subnet_mask, none()) assert_that(port.gateway_address, none())
Example #14
Source File: verifiers.py From storops with Apache License 2.0 | 6 votes |
def verify_raid0(rg): assert_that(rg.raid_group_id, equal_to(0)) assert_that(rg.raid_group_type, equal_to(VNXRaidType.RAID5)) assert_that(rg.state, equal_to('Valid_luns')) assert_that(rg.disks.index, has_items('0_0_A0', '0_0_A1', '0_0_A2', '0_0_A3', '0_0_A4')) assert_that(rg.list_of_luns, has_item(63868)) assert_that(len(rg.list_of_luns), equal_to(16)) assert_that(rg.max_number_of_disks, equal_to(16)) assert_that(rg.max_number_of_luns, equal_to(256)) assert_that(rg.raw_capacity_blocks, equal_to(4502487040)) assert_that(rg.logical_capacity_blocks, equal_to(4502478848)) assert_that(rg.free_capacity_blocks_non_contiguous, equal_to(3744083968)) assert_that(rg.free_contiguous_group_of_unbound_segments, equal_to(1749913216)) assert_that(rg.defrag_expand_priority, equal_to('N/A')) assert_that(rg.percent_defragmented, none()) assert_that(rg.percent_expanded, none()) assert_that(rg.disk_expanding_onto, equal_to('N/A')) assert_that(rg.lun_expansion_enabled, equal_to(False)) assert_that(rg.legal_raid_types[0], equal_to(VNXRaidType.RAID5))
Example #15
Source File: profile.py From selene-backend with GNU Affero General Public License v3.0 | 6 votes |
def validate_response(context): response_data = context.response.json account = context.accounts['foo'] assert_that( response_data['emailAddress'], equal_to(account.email_address) ) assert_that( response_data['membership']['type'], equal_to('Monthly Membership') ) assert_that(response_data['membership']['duration'], none()) assert_that( response_data['membership'], has_item('id') ) assert_that(len(response_data['agreements']), equal_to(3)) agreement = response_data['agreements'][0] assert_that(agreement['type'], equal_to(PRIVACY_POLICY)) assert_that( agreement['acceptDate'], equal_to(str(date.today().strftime('%B %d, %Y'))) ) assert_that(agreement, has_item('id'))
Example #16
Source File: test__instance_api.py From django-river with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test__shouldHandleUndefinedSecondWorkflowCase(self): state1 = StateObjectFactory(label="state1") state2 = StateObjectFactory(label="state2") content_type = ContentType.objects.get_for_model(ModelWithTwoStateFields) workflow = WorkflowFactory(initial_state=state1, content_type=content_type, field_name="status1") transition_meta = TransitionMetaFactory.create( workflow=workflow, source_state=state1, destination_state=state2, ) TransitionApprovalMetaFactory.create( workflow=workflow, transition_meta=transition_meta, priority=0, ) workflow_object = ModelWithTwoStateFieldsObjectFactory() assert_that(workflow_object.model.status1, equal_to(state1)) assert_that(workflow_object.model.status2, none())
Example #17
Source File: verifiers.py From storops with Apache License 2.0 | 6 votes |
def verify_lun_0(lun): assert_that(lun.lun_id, equal_to(0)) assert_that(lun.name, equal_to('File_CS0_21132_0_d7')) assert_that(lun.state, equal_to('Ready')) assert_that(lun.current_owner, equal_to(VNXSPEnum.SP_A)) assert_that(lun.default_owner, equal_to(VNXSPEnum.SP_A)) assert_that(lun.wwn, equal_to( '60:06:01:60:12:60:3D:00:95:63:38:87:9D:69:E5:11')) assert_that(lun.operation, equal_to('None')) assert_that(lun.pool_name, equal_to('Pool4File')) assert_that(lun.is_thin_lun, equal_to(False)) assert_that(lun.is_compressed, equal_to(False)) assert_that(lun.is_dedup, equal_to(False)) assert_that(lun.is_private, equal_to(False)) assert_that(lun.tier, equal_to(VNXTieringEnum.HIGH_AUTO)) assert_that(lun.provision, equal_to(VNXProvisionEnum.THICK)) assert_that(lun.user_capacity_gbs, equal_to(500.0)) assert_that(lun.consumed_capacity_gbs, equal_to(512.249)) assert_that(lun.existed, equal_to(True)) assert_that(lun.primary_lun, none()) assert_that(lun.is_snap_mount_point, equal_to(False))
Example #18
Source File: test_metric.py From storops with Apache License 2.0 | 5 votes |
def test_disable_stats(self): assert_that(self.stats.disable_stats(), none())
Example #19
Source File: test_parsers.py From storops with Apache License 2.0 | 5 votes |
def test_get_index_descriptor_none(self): assert_that(DemoParserNonIndex().index_property, none())
Example #20
Source File: test_converter.py From storops with Apache License 2.0 | 5 votes |
def test_name_to_snap_na(self): snap = converter.name_to_snap('N/A') assert_that(snap, none())
Example #21
Source File: test_converter.py From storops with Apache License 2.0 | 5 votes |
def test_name_to_lun_na(self): lun = converter.name_to_lun('N/A') assert_that(lun, none())
Example #22
Source File: test_converter.py From storops with Apache License 2.0 | 5 votes |
def test_id_to_lun_none(self): lun = converter.id_to_lun(None) assert_that(lun, none())
Example #23
Source File: test_fs.py From storops with Apache License 2.0 | 5 votes |
def verify_root_fs_1(fs): assert_that(fs.fs_id, equal_to(1)) assert_that(fs.internal_use, equal_to(True)) assert_that(fs.name, equal_to('root_fs_1')) assert_that(fs.volume, equal_to(10)) assert_that(fs.policies, none()) assert_that(fs.pools, none()) assert_that(fs.storages, equal_to(1)) assert_that(fs.type, equal_to('uxfs')) assert_that(fs.size, equal_to(16))
Example #24
Source File: test_mirror_view.py From storops with Apache License 2.0 | 5 votes |
def test_properties(self): mv = VNXMirrorView.get(t_cli(), 'mv_sync_2') image = mv.get_image('50:06:01:60:88:60:05:FE') assert_that(image.uid, equal_to('50:06:01:60:88:60:05:FE')) assert_that(image.existed, equal_to(True)) assert_that(image.is_primary, equal_to(True)) assert_that(image.logical_unit_uid, equal_to( '60:06:01:60:41:C4:3D:00:6E:1C:50:9D:05:95:E5:11')) assert_that(image.condition, equal_to('Primary Image')) assert_that(image.state, none()) assert_that(image.preferred_sp, equal_to(VNXSPEnum.SP_A))
Example #25
Source File: test_parsers.py From storops with Apache License 2.0 | 5 votes |
def test_parse(self): output = MockCli.read_file('storagepool_-list_-all_-id_1.txt') parser = get_vnx_parser('VNXPool') pool = parser.parse(output) assert_that(pool.state, equal_to('Ready')) assert_that(pool.pool_id, equal_to(1)) assert_that(pool.user_capacity_gbs, equal_to(2329.792)) assert_that(pool.available_capacity_gbs, equal_to(1473.623)) assert_that(pool.fast_cache, none()) assert_that(pool.name, equal_to('Pool_daq')) assert_that(pool.total_subscribed_capacity_gbs, equal_to(2701.767)) assert_that(pool.percent_full_threshold, equal_to(70))
Example #26
Source File: test_snap.py From storops with Apache License 2.0 | 5 votes |
def test_filesystem_snap(self): snap = UnitySnap(cli=t_rest(), _id='171798691852') fs = snap.filesystem assert_that(fs, instance_of(UnityFileSystem)) assert_that(fs.storage_resource, equal_to(snap.storage_resource)) assert_that(snap.lun, none())
Example #27
Source File: test_snap.py From storops with Apache License 2.0 | 5 votes |
def test_lun_snap(self): snap = UnitySnap(cli=t_rest(), _id='38654705785') lun = snap.lun assert_that(lun, instance_of(UnityLun)) assert_that(snap.filesystem, none())
Example #28
Source File: test_filesystem.py From storops with Apache License 2.0 | 5 votes |
def test_properties(self): fs = UnityFileSystem(_id='fs_2', cli=t_rest()) assert_that(fs.id, equal_to('fs_2')) assert_that(fs.type, equal_to(FilesystemTypeEnum.FILESYSTEM)) assert_that(fs.tiering_policy, equal_to(TieringPolicyEnum.AUTOTIER_HIGH)) assert_that(fs.supported_protocols, equal_to(FSSupportedProtocolEnum.CIFS)) assert_that(fs.access_policy, equal_to(AccessPolicyEnum.WINDOWS)) assert_that(fs.format, equal_to(FSFormatEnum.UFS64)) assert_that(fs.host_io_size, equal_to(HostIOSizeEnum.GENERAL_8K)) assert_that(fs.pool_full_policy, equal_to(ResourcePoolFullPolicyEnum.DELETE_ALL_SNAPS)) assert_that(fs.health, instance_of(UnityHealth)) assert_that(fs.name, equal_to('esa_cifs1')) assert_that(fs.description, equal_to('')) assert_that(fs.size_total, equal_to(5368709120)) assert_that(fs.size_used, equal_to(1642971136)) assert_that(fs.size_allocated, equal_to(3221225472)) assert_that(fs.is_read_only, equal_to(False)) assert_that(fs.is_thin_enabled, equal_to(True)) assert_that(fs.is_cifs_sync_writes_enabled, equal_to(False)) assert_that(fs.is_cifs_op_locks_enabled, equal_to(True)) assert_that(fs.is_cifs_notify_on_write_enabled, equal_to(False)) assert_that(fs.is_cifs_notify_on_access_enabled, equal_to(False)) assert_that(fs.cifs_notify_on_change_dir_depth, equal_to(512)) assert_that(fs.metadata_size, equal_to(3489660928)) assert_that(fs.metadata_size_allocated, equal_to(3221225472)) assert_that(fs.per_tier_size_used, equal_to([6442450944, 0, 0])) assert_that(fs.snaps_size, equal_to(0)) assert_that(fs.snaps_size_allocated, equal_to(0)) assert_that(fs.snap_count, equal_to(0)) assert_that(fs.is_smbca, equal_to(False)) assert_that(fs.storage_resource, instance_of(UnityStorageResource)) assert_that(fs.pool, instance_of(UnityPool)) assert_that(fs.nas_server, instance_of(UnityNasServer)) assert_that(fs.cifs_share, instance_of(UnityCifsShareList)) assert_that(len(fs.cifs_share), equal_to(1)) assert_that(fs.nfs_share, none())
Example #29
Source File: test_resp.py From storops with Apache License 2.0 | 5 votes |
def test_unity_exception_default_error_code(self): assert_that(UnityException().error_code, none())
Example #30
Source File: test_parser.py From storops with Apache License 2.0 | 5 votes |
def test_get_property_label_not_found(self): parser = DemoParser() assert_that(parser.get_property_label('na'), none())