<s> import mock <EOL> from nova import test <EOL> from nova_solverscheduler . scheduler . solvers . constraints import aggregate_multitenancy_isolation <EOL> from nova_solverscheduler . tests . scheduler import solver_scheduler_fakes as fakes <EOL> class TestAggregateMultiTenancyIsolationConstraint ( test . NoDBTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestAggregateMultiTenancyIsolationConstraint , self ) . setUp ( ) <EOL> self . constraint_cls = aggregate_multitenancy_isolation . AggregateMultiTenancyIsolationConstraint <EOL> self . _generate_fake_constraint_input ( ) <EOL> def _generate_fake_constraint_input ( self ) : <EOL> self . fake_filter_properties = { <EOL> '<STR_LIT>' : [ '<STR_LIT>' % x for x in range ( <NUM_LIT:3> ) ] , <EOL> '<STR_LIT>' : <NUM_LIT:3> } <EOL> host1 = fakes . FakeSolverSchedulerHostState ( '<STR_LIT>' , '<STR_LIT>' , { } ) <EOL> host2 = fakes . FakeSolverSchedulerHostState ( '<STR_LIT>' , '<STR_LIT>' , { } ) <EOL> self . fake_hosts = [ host1 , host2 ] <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_get_constraint_matrix ( self , mock_filter_cls ) : <EOL> expected_cons_mat = [ <EOL> [ True , True , True ] , <EOL> [ False , False , False ] ] <EOL> mock_filter = mock_filter_cls . return_value <EOL> mock_filter . host_passes . side_effect = [ True , False ] <EOL> cons_mat = self . constraint_cls ( ) . get_constraint_matrix ( <EOL> self . fake_hosts , self . fake_filter_properties ) <EOL> self . assertEqual ( expected_cons_mat , cons_mat ) </s>
