summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional/ispy/common/mock_cloud_bucket.py
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/functional/ispy/common/mock_cloud_bucket.py')
-rw-r--r--chrome/test/functional/ispy/common/mock_cloud_bucket.py65
1 files changed, 0 insertions, 65 deletions
diff --git a/chrome/test/functional/ispy/common/mock_cloud_bucket.py b/chrome/test/functional/ispy/common/mock_cloud_bucket.py
deleted file mode 100644
index 803fd57..0000000
--- a/chrome/test/functional/ispy/common/mock_cloud_bucket.py
+++ /dev/null
@@ -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))