def test_no_howtos(self): with temporary_directory() as serve_root: settings.SERVED_PATHS = [serve_root.root] serve_root.make_file("build/9/build.tar.bz2", with_buildinfo=True) response = self.client.get('/build/9/') self.assertEqual(response.status_code, 200) self.assertContains(response, 'build.tar.bz2')
def test_howtos_howto_dir(self): with temporary_directory() as serve_root: settings.SERVED_PATHS = [serve_root.root] serve_root.make_file("build/9/build.tar.bz2", with_buildinfo=True) serve_root.make_file("build/9/howto/HOWTO_releasenotes.txt", data=".h1 HowTo Test") response = self.client.get('/build/9/howto/') self.assertEqual(response.status_code, 200) self.assertContains(response, 'HowTo Test')
def test_buildinfo_simple_filename(self): with temporary_directory() as serve_root: sample_file = serve_root.make_file("MD5SUM", data="blah") serve_root.make_file("BUILD-INFO.txt", data=("Format-Version: 2.0\n\n" "Files-Pattern: MD5SUM\n" "License-Type: open\n")) build_info = BuildInfo(sample_file) file_info = build_info.getInfoForFile() self.assertEqual('open', file_info[0]['license-type'])
def test_static_file(self): with temporary_directory() as serve_root: settings.SERVED_PATHS = [serve_root.root] serve_root.make_file("MD5SUM") serve_root.make_file("BUILD-INFO.txt", data=("Format-Version: 2.0\n\n" "Files-Pattern: MD5SUM\n" "License-Type: open\n")) response = self.client.get('/MD5SUM') self.assertEqual(response.status_code, 200)
def test_howtos_with_license_in_openeula(self): with temporary_directory() as serve_root: settings.SERVED_PATHS = [serve_root.root] serve_root.make_file("build/9/build.tar.bz2", with_buildinfo=True) serve_root.make_file("build/9/howto/HOWTO_test.txt", data=".h1 HowTo Test", with_buildinfo=False) serve_root.make_file("build/9/howto/OPEN-EULA.txt", with_buildinfo=False) response = self.client.get('/build/9/') self.assertEqual(response.status_code, 200) self.assertContains(response, 'howto')