summaryrefslogtreecommitdiff
path: root/paste/fixture.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-09-07 18:05:54 +0000
committerianb <devnull@localhost>2005-09-07 18:05:54 +0000
commita3dce3bc2fa418ad1c3f1a80ca2c259b1e331623 (patch)
treecad288135f41e9febee075ff2020a3cea7c622b9 /paste/fixture.py
parent533d4eb47a3a72a7142e742b778782ff84a2e034 (diff)
downloadpaste-a3dce3bc2fa418ad1c3f1a80ca2c259b1e331623.tar.gz
Added file content assertions
Diffstat (limited to 'paste/fixture.py')
-rw-r--r--paste/fixture.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/paste/fixture.py b/paste/fixture.py
index f79da67..8a1f27d 100644
--- a/paste/fixture.py
+++ b/paste/fixture.py
@@ -678,6 +678,22 @@ class FoundFile(object):
self.stat = os.stat(self.full)
self.mtime = self.stat.st_mtime
self.size = self.stat.st_size
+ self._bytes = None
+
+ def bytes__get(self):
+ if self._bytes is None:
+ f = open(self.full, 'rb')
+ self._bytes = f.read()
+ f.close()
+ return self._bytes
+ bytes = property(bytes__get)
+
+ def __contain__(self, s):
+ return s in self.bytes
+
+ def mustcontain(self, s):
+ bytes = self.bytes
+ assert s in bytes
class FoundDir(object):