Пример #1
0
    def test_get_release_info(self):
        # making sure there is a release
        generate_biom_and_metadata_release('private')
        # just checking that is not empty cause the MD5 will change on every
        # run
        md5sum, filepath, timestamp = get_release_info('private')
        self.assertNotEqual(md5sum, '')
        self.assertNotEqual(filepath, '')
        self.assertNotEqual(timestamp, '')

        md5sum, filepath, timestamp = get_release_info('public')
        self.assertEqual(md5sum, '')
        self.assertEqual(filepath, '')
        self.assertEqual(timestamp, '')
Пример #2
0
    def test_get_release_info(self):
        # making sure there is a release
        generate_biom_and_metadata_release('private')
        # just checking that is not empty cause the MD5 will change on every
        # run
        md5sum, filepath, timestamp = get_release_info('private')
        self.assertNotEqual(md5sum, '')
        self.assertNotEqual(filepath, '')
        self.assertNotEqual(timestamp, '')

        md5sum, filepath, timestamp = get_release_info('public')
        self.assertEqual(md5sum, '')
        self.assertEqual(filepath, '')
        self.assertEqual(timestamp, '')
Пример #3
0
    def test_get_release_info(self):
        # making sure there is a release
        generate_biom_and_metadata_release('private')
        # just checking that is not empty cause the MD5 will change on every
        # run
        biom_metadata_release, archive_release = get_release_info('private')
        # note that we are testing not equal as we should have some information
        # and then we will test that at least the 2nd element is correct
        self.assertNotEqual(biom_metadata_release, ('', '', ''))
        self.assertEqual(biom_metadata_release[1],
                         b'releases/QIITA-private.tgz')
        self.assertEqual(archive_release, ('', '', ''))

        generate_plugin_releases()
        biom_metadata_release, archive_release = get_release_info('public')
        self.assertEqual(biom_metadata_release, ('', '', ''))
        self.assertNotEqual(archive_release, ('', '', ''))
Пример #4
0
    def test_get_release_info(self):
        # making sure there is a release
        generate_biom_and_metadata_release('private')
        # just checking that is not empty cause the MD5 will change on every
        # run
        biom_metadata_release, archive_release = get_release_info('private')
        # note that we are testing not equal as we should have some information
        # and then we will test that at least the 2nd element is correct
        self.assertNotEqual(biom_metadata_release, ('', '', ''))
        self.assertEqual(biom_metadata_release[1],
                         b'releases/QIITA-private.tgz')
        self.assertEqual(archive_release, ('', '', ''))

        generate_plugin_releases()
        biom_metadata_release, archive_release = get_release_info('public')
        self.assertEqual(biom_metadata_release, ('', '', ''))
        self.assertNotEqual(archive_release, ('', '', ''))
Пример #5
0
    def get(self, extras):
        _, relpath, _ = get_release_info()

        # If we don't have nginx, write a file that indicates this
        # Note that this configuration will automatically create and download
        # ("on the fly") the zip file via the contents in all_files
        self._write_nginx_placeholder_file(relpath)

        self._set_nginx_headers(basename(relpath))

        self.set_header('Content-Type', 'application/octet-stream')
        self.set_header('Content-Transfer-Encoding', 'binary')
        self.set_header('X-Accel-Redirect',
                        '/protected-working_dir/' + relpath)
        self.finish()
Пример #6
0
    def get(self, extras):
        _, relpath, _ = get_release_info()

        # If we don't have nginx, write a file that indicates this
        # Note that this configuration will automatically create and download
        # ("on the fly") the zip file via the contents in all_files
        self._write_nginx_placeholder_file(relpath)

        self._set_nginx_headers(basename(relpath))

        self.set_header('Content-Type', 'application/octet-stream')
        self.set_header('Content-Transfer-Encoding', 'binary')
        self.set_header('X-Accel-Redirect',
                        '/protected-working_dir/' + relpath)
        self.finish()
Пример #7
0
    def get(self, extras):
        _, relpath, _ = get_release_info()

        # If we don't have nginx, write a file that indicates this
        # Note that this configuration will automatically create and download
        # ("on the fly") the zip file via the contents in all_files
        self.write("This installation of Qiita was not equipped with nginx, "
                   "so it is incapable of serving files. The file you "
                   "attempted to download is located at %s" % relpath)

        self.set_header('Content-Description', 'File Transfer')
        self.set_header('Content-Type', 'application/octet-stream')
        self.set_header('Content-Transfer-Encoding', 'binary')
        self.set_header('Expires', '0')
        self.set_header('Cache-Control', 'no-cache')
        self.set_header('X-Accel-Redirect',
                        '/protected-working_dir/' + relpath)
        self.set_header('Content-Disposition',
                        'attachment; filename=%s' % basename(relpath))
        self.finish()