def test_load_from_zipfile_invalid_extension(self): strm = StringIO('w') zipf = zipfile.ZipFile(strm, 'w') coll_name = get_collection_name(get_collection_class(IMyEntity)) zipf.writestr('%s.foo' % coll_name, '') zipf.close() colls = [get_root_collection(IMyEntity)] with self.assert_raises(ValueError) as cm: dummy = load_into_collections_from_zipfile(colls, strm) exc_msg = 'Could not infer MIME type' self.assert_true(cm.exception.message.startswith(exc_msg))
def test_commit(self): coll = get_root_collection(IMyEntity) mb = iter(coll).next() TEXT = 'Changed.' mb.text = TEXT transaction.commit() with open(os.path.join(self._data_dir, "%s.csv" % get_collection_name(coll)), 'rU') as data_file: lines = data_file.readlines() data = lines[1].split(',') self.assert_equal(data[3], '"%s"' % TEXT)
def test_commit(self): coll = get_root_collection(IMyEntity) mb = iter(coll).next() TEXT = 'Changed.' mb.text = TEXT transaction.commit() with open( os.path.join(self._data_dir, "%s.csv" % get_collection_name(coll)), 'rU') as data_file: lines = data_file.readlines() data = lines[1].split(',') self.assert_equal(data[3], '"%s"' % TEXT)