<s> from mock import Mock , patch <EOL> import unittest <EOL> from contextio . lib . resources . file import File <EOL> class TestFile ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . file = File ( Mock ( ) , { "<STR_LIT>" : "<STR_LIT>" } ) <EOL> def test_constructor_creates_file_object_with_all_attributes_in_keys_list ( self ) : <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT:size>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT:type>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT:date>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> self . assertTrue ( hasattr ( self . file , "<STR_LIT>" ) ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_get_content_calls_request_uri_with_correct_arguments ( self , mock_request ) : <EOL> file = File ( Mock ( ) , { "<STR_LIT>" : "<STR_LIT>" } ) <EOL> file . get_content ( ) <EOL> mock_request . assert_called_with ( "<STR_LIT:content>" , headers = { } ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_get_content_calls_request_uri_with_correct_arguments_when_download_link_is_True ( self , mock_request ) : <EOL> file = File ( Mock ( ) , { "<STR_LIT>" : "<STR_LIT>" } ) <EOL> file . get_content ( download_link = True ) <EOL> mock_request . assert_called_with ( "<STR_LIT:content>" , headers = { "<STR_LIT>" : "<STR_LIT>" } ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test_get_related_returns_a_list_of_File_objects ( self , mock_request ) : <EOL> mock_request . return_value = [ { "<STR_LIT>" : "<STR_LIT>" } ] <EOL> related_files = self . file . get_related ( ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( related_files ) ) <EOL> self . assertIsInstance ( related_files [ <NUM_LIT:0> ] , File ) </s>
