Ejemplo n.º 1
0
 def test_load_from_zipfile_invalid_extension(self):
     strm = BytesIO()
     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:
         load_into_collections_from_zipfile(colls, strm)
     exc_msg = 'Could not infer MIME type'
     self.assert_true(str(cm.exception).startswith(exc_msg))
Ejemplo n.º 2
0
 def test_load_from_zipfile_invalid_extension(self):
     strm = BytesIO()
     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:
         load_into_collections_from_zipfile(colls, strm)
     exc_msg = 'Could not infer MIME type'
     self.assert_true(str(cm.exception).startswith(exc_msg))
Ejemplo n.º 3
0
 def test_commit(self, data_dir, resource_repo_with_data):
     coll = resource_repo_with_data.get_collection(IMyEntity)
     mb = next(iter(coll))
     TEXT = 'Changed.'
     mb.text = TEXT
     transaction.commit()
     with open(os.path.join(data_dir, "%s.csv" % get_collection_name(coll)),
               'rU') as data_file:
         lines = data_file.readlines()
     data = lines[1].split(',')
     assert data[2] == '"%s"' % TEXT
Ejemplo n.º 4
0
 def test_commit(self, data_dir, resource_repo_with_data):
     coll = resource_repo_with_data.get_collection(IMyEntity)
     mb = next(iter(coll))
     TEXT = 'Changed.'
     mb.text = TEXT
     transaction.commit()
     with open(os.path.join(data_dir,
                            "%s.csv" % get_collection_name(coll)),
               'rU') as data_file:
         lines = data_file.readlines()
     data = lines[1].split(',')
     assert data[2] == '"%s"' % TEXT
Ejemplo n.º 5
0
 def test_commit(self):
     coll = get_root_collection(IMyEntity)
     mb = next(iter(coll))
     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[2], '"%s"' % TEXT)