| Index: chrome/test/functional/ispy/common/mock_cloud_bucket.py
|
| ===================================================================
|
| --- chrome/test/functional/ispy/common/mock_cloud_bucket.py (revision 261231)
|
| +++ chrome/test/functional/ispy/common/mock_cloud_bucket.py (working copy)
|
| @@ -1,65 +0,0 @@
|
| -# Copyright 2013 The Chromium Authors. All rights reserved.
|
| -# Use of this source code is governed by a BSD-style license that can be
|
| -# found in the LICENSE file.
|
| -
|
| -"""Subclass of CloudBucket used for testing."""
|
| -
|
| -import os
|
| -import sys
|
| -
|
| -sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
|
| -import cloud_bucket
|
| -
|
| -
|
| -class MockCloudBucket(cloud_bucket.BaseCloudBucket):
|
| - """Subclass of CloudBucket used for testing."""
|
| -
|
| - def __init__(self):
|
| - """Initializes the MockCloudBucket with its datastore.
|
| -
|
| - Returns:
|
| - An instance of MockCloudBucket.
|
| - """
|
| - self.datastore = {}
|
| -
|
| - def Reset(self):
|
| - """Clears the MockCloudBucket's datastore."""
|
| - self.datastore = {}
|
| -
|
| - # override
|
| - def UploadFile(self, path, contents, content_type):
|
| - self.datastore[path] = contents
|
| -
|
| - # override
|
| - def DownloadFile(self, path):
|
| - if self.datastore.has_key(path):
|
| - return self.datastore[path]
|
| - else:
|
| - raise cloud_bucket.FileNotFoundError
|
| -
|
| - # override
|
| - def UpdateFile(self, path, contents):
|
| - if not self.FileExists(path):
|
| - raise cloud_bucket.FileNotFoundError
|
| - self.UploadFile(path, contents, '')
|
| -
|
| - # override
|
| - def RemoveFile(self, path):
|
| - if self.datastore.has_key(path):
|
| - self.datastore.pop(path)
|
| -
|
| - # override
|
| - def FileExists(self, path):
|
| - return self.datastore.has_key(path)
|
| -
|
| - # override
|
| - def GetImageURL(self, path):
|
| - if self.datastore.has_key(path):
|
| - return path
|
| - else:
|
| - raise cloud_bucket.FileNotFoundError
|
| -
|
| - # override
|
| - def GetAllPaths(self, prefix):
|
| - return (item[0] for item in self.datastore.items()
|
| - if item[0].startswith(prefix))
|
|
|