Example #1
0
 def test_add_subm_to_zip(self):
     """ Test that submission contents added to zip """
     results = api.SearchAPI.results({"query": ""})
     for result in results:
         subm = api.SubmissionAPI()
         zipfile_str, zipfile = utils.start_zip()
         zipfile = utils.add_subm_to_zip(subm, zipfile, result)
         assert zipfile is None or len(zipfile.infolist()) > 0
 def test_add_subm_to_zip(self):
     """ Test that submission contents added to zip """
     results = api.SearchAPI.results({'query': ''})
     for result in results:
         subm = api.SubmissionAPI()
         zipfile_str, zipfile = utils.start_zip()
         zipfile = utils.add_subm_to_zip(subm, zipfile, result)
         assert zipfile is None or len(zipfile.infolist()) > 0
Example #3
0
	def test_start_zip_dir(self):
		""" Test that files are saved under specified directory """
		file_contents, dir = dict(a='file a contents', b='file b contents'), 'dir'
		zipfile_str, zipfile = utils.start_zip(file_contents, dir)
		zipinfo = zipfile.infolist()
		zipnames = [z.filename for z in zipinfo]
		assert 'dir/a' in zipnames
		assert 'dir/b' in zipnames
		return zipfile_str, zipfile
Example #4
0
	def test_start_zip_filecontents(self):
		""" Test that zip is initialized with file contents dict properly """
		file_contents = dict(a='file a contents', b='file b contents')
		zipfile_str, zipfile = utils.start_zip(file_contents)
		zipinfo = zipfile.infolist()
		zipnames = [z.filename for z in zipinfo]
		assert 'a' in zipnames
		assert 'b' in zipnames
		return zipfile_str, zipfile
 def test_start_zip_filecontents(self):
     """ Test that zip is initialized with file contents dict properly """
     file_contents = dict(a='file a contents', b='file b contents')
     zipfile_str, zipfile = utils.start_zip(file_contents)
     zipinfo = zipfile.infolist()
     zipnames = [z.filename for z in zipinfo]
     assert 'a' in zipnames
     assert 'b' in zipnames
     return zipfile_str, zipfile
Example #6
0
	def test_start_zip_dir(self):
		""" Test that files are saved under specified directory """
		file_contents, dir = dict(a='file a contents', b='file b contents'), 'dir'
		zipfile_str, zipfile = utils.start_zip(file_contents, dir)
		zipinfo = zipfile.infolist()
		zipnames = [z.filename for z in zipinfo]
		assert 'dir/a' in zipnames
		assert 'dir/b' in zipnames
		return zipfile_str, zipfile
Example #7
0
	def test_start_zip_basic(self):
		""" Test that a zip is started properly """
		zipfile_str, zipfile = utils.start_zip()
		assert zipfile_str is not None
		assert zipfile is not None
		return zipfile_str, zipfile
 def test_start_zip_basic(self):
     """ Test that a zip is started properly """
     zipfile_str, zipfile = utils.start_zip()
     assert zipfile_str is not None
     assert zipfile is not None
     return zipfile_str, zipfile