1
# Copyright 2017 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
6
from testtools.matchers import (
13
class HasWaitingFiles(Matcher):
14
"""Match files that have been added using `builder.addWaitingFile`."""
16
def __init__(self, files):
20
def byEquality(cls, files):
22
{name: Equals(contents) for name, contents in files.items()})
24
def match(self, builder):
25
waiting_file_contents = {}
26
for name in builder.waitingfiles:
27
cache_path = builder.cachePath(builder.waitingfiles[name])
28
with open(cache_path, "rb") as f:
29
waiting_file_contents[name] = f.read()
30
return MatchesDict(self.files).match(waiting_file_contents)