예제 #1
0
 def test_delete_raises_file_not_found_for_unknown_file(self):
     mock_s3()
     (flexmock(S3Connection).should_receive('get_bucket').and_return(
         MockBucket()))
     storage = S3BotoStorage('some bucket')
     with raises(FileNotFoundError):
         storage.delete('key')
예제 #2
0
    def setup_method(self, method):
        TestCase.setup_method(self, method)
        flexmock(S3BotoStorage) \
            .should_receive('_get_or_create_bucket') \
            .with_args('some_bucket') \
            .and_return(MockBucket())

        self.storage = S3BotoStorage('some_bucket')
        self.file = S3BotoStorageFile(self.storage, 'some_file')
예제 #3
0
    def test_open_returns_file_object(self):
        mock_s3()

        flexmock(S3BotoStorage) \
            .should_receive('_get_or_create_bucket') \
            .with_args('some_bucket') \
            .and_return(MockBucket())
        storage = S3BotoStorage('some_bucket')
        file_ = storage.open('some_file')
        assert isinstance(file_, S3BotoStorageFile)
예제 #4
0
 def test_save_file_with_content_as_string(self):
     mock_s3()
     (flexmock(S3Connection).should_receive('get_bucket').and_return(
         MockBucket()))
     storage = S3BotoStorage('some bucket')
     storage.save('some_file', 'some content')
예제 #5
0
 def test_list_files_returns_list_of_key_names(self):
     mock_s3()
     (flexmock(S3Connection).should_receive('get_bucket').and_return(
         MockBucket()))
     storage = S3BotoStorage('some bucket')
     assert storage.list_files() == []
예제 #6
0
 def test_assigns_folder_on_initialization(self):
     mock_s3()
     storage = S3BotoStorage('some bucket')
     assert storage.folder_name == 'some bucket'
예제 #7
0
 def setup_method(self, method):
     TestCase.setup_method(self, method)
     self.storage = S3BotoStorage()