~coreygoldberg/uci-engine/subunit-results

« back to all changes in this revision

Viewing changes to subunit-results/subunitresults/ci_utils/testing/fixtures.py

  • Committer: Corey Goldberg
  • Date: 2014-07-31 13:32:14 UTC
  • Revision ID: corey.goldberg@canonical.com-20140731133214-t2ww8nb5n911gqfo
updated FakeDataStore and tests to only accept bytes

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
    def put_file(self, filename, contents, content_type=None):
60
60
        full_path = os.path.join(self.container_id, filename)
61
 
        if content_type is None:
62
 
            with open(full_path, 'w') as f:
63
 
                f.write(contents)
64
 
        else:
65
 
            try:
66
 
                encoding = content_type.parameters['charset']
67
 
            except KeyError:
68
 
                with open(full_path, 'w') as f:
69
 
                    f.write(contents)
70
 
            else:
71
 
                with open(full_path, 'w', encoding=encoding) as f:
72
 
                    f.write(contents.decode(encoding))
 
61
        with open(full_path, 'wb') as f:
 
62
            f.write(contents)
73
63
        return self.file_path(filename)
74
64
 
75
65
    def get_file(self, filename):
76
66
        full_path = os.path.join(self.container_id, filename)
77
 
        with open(full_path) as f:
 
67
        with open(full_path, 'rb') as f:
78
68
            return f.read()
79
69
 
80
70
    def delete_file(self, filename):