begin_unit
comment|'#    Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'#    not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'#    a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#         http://www.apache.org/licenses/LICENSE-2.0'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#    Unless required by applicable law or agreed to in writing, software'
nl|'\n'
comment|'#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
nl|'\n'
comment|'#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
nl|'\n'
comment|'#    License for the specific language governing permissions and limitations'
nl|'\n'
comment|'#    under the License.'
nl|'\n'
nl|'\n'
name|'from'
name|'nova'
name|'import'
name|'objects'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'scheduler'
op|'.'
name|'filters'
name|'import'
name|'exact_disk_filter'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'test'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
op|'.'
name|'scheduler'
name|'import'
name|'fakes'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|TestExactDiskFilter
name|'class'
name|'TestExactDiskFilter'
op|'('
name|'test'
op|'.'
name|'NoDBTestCase'
op|')'
op|':'
newline|'\n'
nl|'\n'
DECL|member|setUp
indent|'    '
name|'def'
name|'setUp'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'super'
op|'('
name|'TestExactDiskFilter'
op|','
name|'self'
op|')'
op|'.'
name|'setUp'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'filt_cls'
op|'='
name|'exact_disk_filter'
op|'.'
name|'ExactDiskFilter'
op|'('
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_exact_disk_filter_passes
dedent|''
name|'def'
name|'test_exact_disk_filter_passes'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'spec_obj'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'flavor'
op|'='
name|'objects'
op|'.'
name|'Flavor'
op|'('
name|'root_gb'
op|'='
number|'1'
op|','
name|'ephemeral_gb'
op|'='
number|'1'
op|','
name|'swap'
op|'='
number|'1024'
op|')'
op|')'
newline|'\n'
name|'disk_gb'
op|'='
number|'3'
newline|'\n'
name|'host'
op|'='
name|'self'
op|'.'
name|'_get_host'
op|'('
op|'{'
string|"'free_disk_mb'"
op|':'
name|'disk_gb'
op|'*'
number|'1024'
op|','
nl|'\n'
string|"'total_usable_disk_gb'"
op|':'
name|'disk_gb'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host'
op|'.'
name|'limits'
op|'.'
name|'get'
op|'('
string|"'disk_gb'"
op|')'
op|','
name|'disk_gb'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_exact_disk_filter_fails
dedent|''
name|'def'
name|'test_exact_disk_filter_fails'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'spec_obj'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'flavor'
op|'='
name|'objects'
op|'.'
name|'Flavor'
op|'('
name|'root_gb'
op|'='
number|'1'
op|','
name|'ephemeral_gb'
op|'='
number|'1'
op|','
name|'swap'
op|'='
number|'1024'
op|')'
op|')'
newline|'\n'
name|'host'
op|'='
name|'self'
op|'.'
name|'_get_host'
op|'('
op|'{'
string|"'free_disk_mb'"
op|':'
number|'2'
op|'*'
number|'1024'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertNotIn'
op|'('
string|"'disk_gb'"
op|','
name|'host'
op|'.'
name|'limits'
op|')'
newline|'\n'
nl|'\n'
DECL|member|_get_host
dedent|''
name|'def'
name|'_get_host'
op|'('
name|'self'
op|','
name|'host_attributes'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'return'
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
name|'host_attributes'
op|')'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit
