#NEWLINE# def test_query_device_capacity_linux_everything_is_wonderful( self ) : #NEWLINE# #INDENT# 'query device capacity works on a happy Linux host' #NEWLINE# with nested ( mock . patch ( 'os.stat' ) , mock . patch ( 'stat.S_ISBLK' ) , mock . patch ( 'platform.system' ) , mock . patch ( 'fcntl.ioctl' ) ) as ( os_stat , stat_is_block , plat_system , ioctl ) : #NEWLINE# #INDENT# os_stat . return_value = mock . Mock ( st_mode = 25008 ) #NEWLINE# stat_is_block . return_value = True #NEWLINE# plat_system . return_value = 'Linux' #NEWLINE# ioctl . return_value = struct . pack ( 'L' , 244140625 ) #NEWLINE# buffer_test = ( ' ' * struct . calcsize ( 'L' ) ) #NEWLINE# bytes = bitmath . query_device_capacity ( device ) #NEWLINE# self . assertEqual ( bytes , 244140625 ) #NEWLINE# self . assertEqual ( buffer_test . call_count , 1 ) #NEWLINE# ioctl . assert_called_once_with ( 4 , 2148012658 , buffer_test )