Python hamcrest.instance_of() Examples
The following are 30
code examples of hamcrest.instance_of().
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_switch_factory.py From fake-switches with Apache License 2.0 | 6 votes |
def test_switch_model_exists(self): core_mock = mock.create_autospec(switch_core.SwitchCore) core_mock.get_default_ports.return_value = mock.sentinel.port_list with mock.patch('fake_switches.switch_factory.switch_configuration') as switch_conf_module: switch_conf_instance = mock.Mock() switch_conf_class = mock.Mock() switch_conf_class.return_value = switch_conf_instance switch_conf_module.SwitchConfiguration = switch_conf_class factory = switch_factory.SwitchFactory(mapping={'a': core_mock}) switch = factory.get('a', 'my_hostname') assert_that(switch, is_(instance_of(switch_core.SwitchCore))) switch_conf_class.assert_called_with('127.0.0.1', name='my_hostname', ports=mock.sentinel.port_list, privileged_passwords=['root']) core_mock.assert_called_with(switch_conf_instance)
Example #2
Source File: test_mirror_view.py From storops with Apache License 2.0 | 6 votes |
def test_get_single(self): mg = VNXMirrorGroup.get(t_cli(), name='petermg') assert_that(mg, instance_of(VNXMirrorGroup)) assert_that(mg.name, equal_to('petermg')) assert_that(mg.gid, equal_to('50:06:01:60:B6:60:25:22:00:00:00:00')) assert_that(mg.description, equal_to('')) assert_that(mg.state, equal_to('Synchronized')) assert_that(mg.role, equal_to('Primary')) assert_that(mg.condition, equal_to('Active')) assert_that(mg.policy, equal_to(VNXMirrorGroupRecoveryPolicy.MANUAL)) assert_that(mg.mirrors, has_length(2)) assert_that(mg.group_mirrors, has_length(2)) for m in mg.mirrors: assert_that(m, instance_of(VNXMirrorView)) for mg in mg.group_mirrors: assert_that( mg.mirror_name, not_none()) assert_that(mg.src_lun_id, instance_of(int))
Example #3
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 #4
Source File: test_snap.py From storops with Apache License 2.0 | 6 votes |
def test_properties(self): snap = UnitySnap(_id=171798691852, cli=t_rest()) assert_that(snap.existed, equal_to(True)) assert_that(snap.state, equal_to(SnapStateEnum.READY)) assert_that(snap.name, equal_to('esa_nfs1_2016-03-15_10:56:29')) assert_that(snap.is_system_snap, equal_to(False)) assert_that(snap.is_modifiable, equal_to(False)) assert_that(snap.is_read_only, equal_to(False)) assert_that(snap.is_modified, equal_to(False)) assert_that(snap.is_auto_delete, equal_to(True)) assert_that(snap.size, equal_to(5368709120)) assert_that(str(snap.creation_time), equal_to('2016-03-15 02:57:27.092000+00:00')) assert_that(snap.storage_resource, instance_of(UnityStorageResource)) assert_that(snap.creator_type, equal_to(SnapCreatorTypeEnum.USER_CUSTOM)) assert_that(snap.access_type, equal_to(FilesystemSnapAccessTypeEnum.CHECKPOINT)) assert_that(snap.is_cg_snap(), equal_to(False))
Example #5
Source File: test_storage_resource.py From storops with Apache License 2.0 | 6 votes |
def test_get_properties(self): sr = UnityStorageResource(_id='res_27', cli=t_rest()) assert_that(sr.id, equal_to('res_27')) assert_that(sr.type, equal_to(StorageResourceTypeEnum.FILE_SYSTEM)) assert_that(sr.replication_type, equal_to(ReplicationTypeEnum.NONE)) assert_that(sr.thin_status, equal_to(ThinStatusEnum.TRUE)) assert_that(sr.relocation_policy, equal_to(TieringPolicyEnum.AUTOTIER_HIGH)) assert_that(sr.health, instance_of(UnityHealth)) assert_that(sr.name, equal_to('fs3')) assert_that(sr.description, equal_to('')) assert_that(sr.is_replication_destination, equal_to(False)) assert_that(sr.size_total, equal_to(3221225472)) assert_that(sr.size_used, equal_to(1620303872)) assert_that(sr.size_allocated, equal_to(3221225472)) assert_that(sr.per_tier_size_used, equal_to([6442450944, 0, 0])) assert_that(sr.metadata_size, equal_to(3489660928)) assert_that(sr.metadata_size_allocated, equal_to(3221225472)) assert_that(sr.snaps_size_total, equal_to(0)) assert_that(sr.snaps_size_allocated, equal_to(0)) assert_that(sr.snap_count, equal_to(0)) assert_that(sr.pools, instance_of(UnityPoolList)) assert_that(sr.filesystem, instance_of(UnityFileSystem))
Example #6
Source File: test_interface.py From storops with Apache License 2.0 | 6 votes |
def test_get_properties(self): fi = UnityFileInterface('if_16', cli=t_rest()) assert_that(fi.existed, equal_to(True)) assert_that(fi.nas_server, instance_of(UnityNasServer)) assert_that(fi.ip_port, instance_of(UnityIpPort)) assert_that(fi.health, instance_of(UnityHealth)) assert_that(fi.ip_address, equal_to('10.244.220.120')) assert_that(fi.ip_protocol_version, equal_to(IpProtocolVersionEnum.IPv4)) assert_that(fi.netmask, equal_to('255.255.255.0')) assert_that(fi.gateway, equal_to('10.244.220.1')) assert_that(fi.mac_address, equal_to('00:60:16:5C:08:E1')) assert_that(fi.name, equal_to('8_FNM00151200215')) assert_that(fi.role, equal_to(FileInterfaceRoleEnum.PRODUCTION)) assert_that(fi.is_preferred, equal_to(True)) assert_that(fi.is_disabled, equal_to(False))
Example #7
Source File: test_nfs_server.py From storops with Apache License 2.0 | 5 votes |
def test_get_properties(self): server = UnityNfsServer('nfs_2', t_rest()) assert_that(server.id, equal_to('nfs_2')) assert_that(server.nfs_v4_enabled, equal_to(True)) assert_that(server.is_secure_enabled, equal_to(False)) assert_that(server.is_extended_credentials_enabled, equal_to(False)) assert_that(server.nas_server, instance_of(UnityNasServer)) assert_that(server.file_interfaces, instance_of(UnityFileInterfaceList)) assert_that(str(server.credentials_cache_ttl), equal_to('0:15:00'))
Example #8
Source File: test_pool.py From storops with Apache License 2.0 | 5 votes |
def test_create_vmfs(self): pool = UnityPool(_id='pool_1', cli=t_rest()) vmfs = pool.create_vmfs(vmfs_name="VMFS datastore", size_gb=100) assert_that(vmfs, instance_of(UnityLun))
Example #9
Source File: test_metric.py From storops with Apache License 2.0 | 5 votes |
def test_set_id_list(self): query_list = UnityMetricRealTimeQueryList(cli=t_rest()) assert_that(len(query_list), equal_to(4)) ret = query_list.set_id_list([17, 22]) assert_that(ret, instance_of(UnityMetricRealTimeQueryList)) assert_that(len(query_list), equal_to(2))
Example #10
Source File: test_converter.py From storops with Apache License 2.0 | 5 votes |
def name_to_snap(self): snap = converter.name_to_snap('abc') assert_that(snap, instance_of(VNXSnap)) assert_that(snap._name, equal_to('abc'))
Example #11
Source File: test_tenant.py From storops with Apache License 2.0 | 5 votes |
def test_properties(self): tenant = UnityTenant('tenant_1', cli=t_rest('4.1.0')) assert_that(tenant.name, equal_to('T1')) assert_that(tenant.uuid, equal_to('173ca6c3-5952-427d-82a6-df88f49e3926')) assert_that(tenant.vlans, instance_of(list)) assert_that(tenant.vlans, only_contains(1, 3)) assert_that(len(tenant.hosts), equal_to(1)) assert_that(tenant.hosts, instance_of(UnityHostList)) assert_that(tenant.nas_servers, instance_of(UnityNasServerList)) assert_that(len(tenant.nas_servers), equal_to(1))
Example #12
Source File: test_dns_server.py From storops with Apache License 2.0 | 5 votes |
def test_get_properties(self): server = UnityFileDnsServer('dns_2', cli=t_rest()) assert_that(server.existed, equal_to(True)) assert_that(server.addresses, only_contains('10.244.209.72')) assert_that(server.domain, equal_to('win2012.dev')) assert_that(server.nas_server, instance_of(UnityNasServer))
Example #13
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 #14
Source File: test_metric.py From storops with Apache License 2.0 | 5 votes |
def test_sp_values(self): result = qr_34.by_path('sp.*.cifs.smb1.basic.writes') assert_that(result.sp_values, instance_of(IdValues)) assert_that(result.sp_values['spa'], equal_to(500))
Example #15
Source File: test_remote_interface.py From storops with Apache License 2.0 | 5 votes |
def test_get_properties(self): ri = remote_interface.UnityRemoteInterface.get( cli=mock.t_rest(), _id='FNM00150600267:if_10') hc.assert_that(ri.address, hc.equal_to('10.245.47.99')) hc.assert_that(ri.capability, hc.equal_to(storops.ReplicationCapabilityEnum.ASYNC)) hc.assert_that(ri.id, hc.equal_to('FNM00150600267:if_10')) hc.assert_that(ri.name, hc.equal_to('4_FNM00150600267')) hc.assert_that(ri.node, hc.equal_to(storops.NodeEnum.SPA)) hc.assert_that(ri.remote_id, hc.equal_to('if_10')) hc.assert_that(ri.remote_system, hc.instance_of(remote_system.UnityRemoteSystem)) hc.assert_that(ri.remote_system.id, hc.equal_to('RS_0'))
Example #16
Source File: test_job_helper.py From storops with Apache License 2.0 | 5 votes |
def test_start(self): self.jh.start() assert_that(self.jh.started, equal_to(True)) assert_that(self.jh.t, instance_of(threading.Thread)) assert_that(self.jh.t.daemon, equal_to(True))
Example #17
Source File: test_get_issues.py From youtrack with MIT License | 5 votes |
def test_get_issue_attributes(self): self.connection = TestGetIssues.connection project = os.getenv('TEST_PROJECT', '') issues = self.connection.get_issues(project, 'for: me #unresolved', 0, 1) pprint.PrettyPrinter(indent=0).pprint(issues) if issues: issue = issues[0] assert_that(issue['id'], is_(instance_of(str)))
Example #18
Source File: test_metric.py From storops with Apache License 2.0 | 5 votes |
def test_combine_sp_values(self): result = qr_128.by_path('sp.*.storage.summary.writes') other = qr_128.by_path('sp.*.storage.blockSize') expected = 1177 * 512 assert_that(result.combine_sp_values(other), instance_of(IdValues)) assert_that(result.combine_sp_values(other)['spb'], equal_to(expected))
Example #19
Source File: test_pool.py From storops with Apache License 2.0 | 5 votes |
def test_create_lun_with_muitl_property(self): pool = UnityPool(_id='pool_1', cli=t_rest()) lun = pool.create_lun("LunName", 100, description="Hello World", is_thin=True, is_repl_dst=True, tiering_policy=TieringPolicyEnum.AUTOTIER_HIGH) assert_that(lun, instance_of(UnityLun))
Example #20
Source File: test_pool.py From storops with Apache License 2.0 | 5 votes |
def test_create_lun_on_spb(self): pool = UnityPool(_id='pool_1', cli=t_rest()) sp = UnityStorageProcessor(_id='spb', cli=t_rest()) lun = pool.create_lun("LunName", 100, sp=sp) assert_that(lun, instance_of(UnityLun))
Example #21
Source File: test_pool.py From storops with Apache License 2.0 | 5 votes |
def test_get_nested_resource_properties(self): pools = UnityPoolList(cli=t_rest()) pool = next(pool for pool in pools if pool.id == 'pool_1') tier = next(t for t in pool.tiers if t.name == 'Performance') unit = next(u for u in tier.pool_units if u.id == 'rg_2') assert_that(unit.type, equal_to(PoolUnitTypeEnum.RAID_GROUP)) assert_that(unit.tier_type, equal_to(TierTypeEnum.PERFORMANCE)) assert_that(unit.name, equal_to("RAID5, #2, pool:perfpool1130")) assert_that(unit.description, equal_to('123')) assert_that(unit.wwn, equal_to( '06:00:00:00:05:00:00:00:01:00:00:00:00:00:00:64')) assert_that(unit.size_total, equal_to(1181501882368)) assert_that(unit.pool, instance_of(UnityPool))
Example #22
Source File: test_pool.py From storops with Apache License 2.0 | 5 votes |
def test_disk_groups(self): cli = t_rest() pool0 = UnityPool.get(cli=cli, _id='pool_1') disk_groups = pool0.disk_groups assert_that(disk_groups, instance_of(dict)) assert_that(len(disk_groups), equal_to(2)) assert_that(disk_groups['dg_8'], instance_of(list)) assert_that(disk_groups['dg_15'], instance_of(list)) for key in disk_groups: for disk in disk_groups[key]: assert_that(disk, instance_of(UnityDisk))
Example #23
Source File: test_alert_config_snmp.py From storops with Apache License 2.0 | 5 votes |
def test_create_alert_snmp_v2_config(self): alert_snmp_config = UnityAlertConfigSNMPTarget.create( cli=t_rest(), target_address='10.10.10.222', community='test_community') assert_that(alert_snmp_config, instance_of( UnityAlertConfigSNMPTarget)) assert_that(alert_snmp_config.get_id(), equal_to( 'snmp_target_9'))
Example #24
Source File: test_alert_config_snmp.py From storops with Apache License 2.0 | 5 votes |
def test_create_alert_snmp_v3_config(self): alert_snmp_config = UnityAlertConfigSNMPTarget.create( cli=t_rest(), target_address='10.10.10.111', username='test_username', auth_protocol=SNMPAuthProtocolEnum.MD5, priv_protocol=SNMPPrivacyProtocolEnum.AES, auth_password='auth_password_test') assert_that(alert_snmp_config, instance_of( UnityAlertConfigSNMPTarget)) assert_that(alert_snmp_config.get_id(), equal_to( 'snmp_target_8')) assert_that(alert_snmp_config.address, equal_to( '10.10.10.111'))
Example #25
Source File: test_snap.py From storops with Apache License 2.0 | 5 votes |
def test_copy_snap_success(self): snap = UnitySnap(cli=t_rest(), _id='38654705785') snap = snap.copy('s3') assert_that(snap.existed, equal_to(True)) assert_that(snap, instance_of(UnitySnap))
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_interface.py From storops with Apache License 2.0 | 5 votes |
def test_get_properties(self): pis = UnityPreferredInterfaceSettings('preferred_if_2', cli=t_rest()) assert_that(pis.existed, equal_to(True)) assert_that(pis.nas_server, instance_of(UnityNasServer))
Example #28
Source File: test_calculator.py From storops with Apache License 2.0 | 5 votes |
def test_get_metric_config(self): config = VNXMetricConfigParser.get_config(VNXLun) metric_config = config.get_metric_config('read_iops') assert_that(metric_config, instance_of(VNXMetricConfig)) assert_that(metric_config.name, equal_to('read_iops'))
Example #29
Source File: test_converter.py From storops with Apache License 2.0 | 5 votes |
def test_ids_to_lun_list_normal(self): lun_list = converter.ids_to_lun_list('0,1,2') lun_list._cli = t_cli() assert_that(lun_list, instance_of(VNXLunList)) assert_that(len(lun_list), equal_to(3))
Example #30
Source File: test_converter.py From storops with Apache License 2.0 | 5 votes |
def test_id_to_lun_normal(self): lun = converter.id_to_lun('12') assert_that(lun, instance_of(VNXLun)) assert_that(lun.get_id(lun), equal_to(12))