Project

General

Profile

Download (3.3 KB) Statistics
| Branch: | Tag: | Revision:

haketilo / test / misc_constants.py @ 3fcff338

1
# SPDX-License-Identifier: AGPL-3.0-or-later
2

    
3
"""
4
Miscellaneous data that were found useful
5
"""
6

    
7
# This file is part of Haketilo.
8
#
9
# Copyright (C) 2021 jahoti <jahoti@tilde.team>
10
# Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org>
11
#
12
# This program is free software: you can redistribute it and/or modify
13
# it under the terms of the GNU Affero General Public License as
14
# published by the Free Software Foundation, either version 3 of the
15
# License, or (at your option) any later version.
16
#
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
# GNU Affero General Public License for more details.
21
#
22
# You should have received a copy of the GNU Affero General Public License
23
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
24
#
25
#
26
# I, Wojtek Kosior, thereby promise not to sue for violation of this
27
# file's license. Although I request that you do not make use this code
28
# in a proprietary program, I am not going to enforce this in court.
29

    
30
from pathlib import Path
31

    
32
here = Path(__file__).resolve().parent
33

    
34
default_firefox_binary = '/usr/lib/icecat/icecat'
35
# The browser might be loading some globally-installed add-ons by default. They
36
# could interfere with the tests, so we'll disable all of them.
37
default_clean_profile_dir = here / 'default_profile' / 'icecat_empty'
38

    
39
default_proxy_host = '127.0.0.1'
40
default_proxy_port = 1337
41

    
42
default_cert_dir = here / 'certs'
43

    
44
# Use user-specified values instead where available
45
try:
46
	with open(str(here.parent / 'testing.conf')) as f:
47
		option = f.readline()
48
		while ' ' in option:
49
			key, value = option[:-1].split(' ', maxsplit=1)
50
			if key == 'BINARY':
51
				default_firefox_binary = value
52
			
53
			elif key == 'TEST_PROFILE':
54
				default_clean_profile_dir = value
55
			
56
			elif key == 'TEST_PORT':
57
				default_proxy_port = value
58
			
59
			else:
60
				raise KeyError(key)
61
			
62
			option = f.readline()
63
except FileNotFoundError:
64
	# There may be no defaults overridden; that's OK!
65
	pass
66

    
67
mime_types = {
68
	"7z": "application/x-7z-compressed",	"oga": "audio/ogg",
69
	"abw": "application/x-abiword",		"ogv": "video/ogg",
70
	"arc": "application/x-freearc",		"ogx": "application/ogg",
71
	"bin": "application/octet-stream",	"opus": "audio/opus",
72
	"bz": "application/x-bzip",		"otf": "font/otf",
73
	"bz2": "application/x-bzip2",		"pdf": "application/pdf",
74
	"css": "text/css",			"png": "image/png",
75
	"csv": "text/csv",			"sh": "application/x-sh",
76
	"gif": "image/gif",			"svg": "image/svg+xml",
77
	"gz": "application/gzip",		"tar": "application/x-tar",
78
	"htm": "text/html",			"ts": "video/mp2t",
79
	"html": "text/html",			"ttf": "font/ttf",
80
	"ico": "image/vnd.microsoft.icon",	"txt": "text/plain",
81
	"js": "text/javascript",		"wav": "audio/wav",
82
	"jpeg": "image/jpeg",			"weba": "audio/webm",
83
	"jpg": "image/jpeg",			"webm": "video/webm",
84
	"json": "application/json",		"woff": "font/woff",
85
	"mjs": "text/javascript",		"woff2": "font/woff2",
86
	"mp3": "audio/mpeg",			"xhtml": "application/xhtml+xml",
87
	"mp4": "video/mp4",			"zip": "application/zip",
88
	"mpeg": "video/mpeg",
89
	"odp": "application/vnd.oasis.opendocument.presentation",
90
	"ods": "application/vnd.oasis.opendocument.spreadsheet",
91
	"odt": "application/vnd.oasis.opendocument.text",
92
	"xml": "application/xml" # text/xml if readable from casual users
93
}
(3-3/8)