Feature/test non generic url (#173)
* new: test: non generic url check method * fix: test: test parameter * chg: test: edit apt url * fix: test: apt parameter * chg: dev: allow `apt:` prefix * new: test: `place:` url * chg: doc: `apt:` prefix
This commit is contained in:
parent
16cad432d7
commit
115c9651f8
@ -269,7 +269,7 @@ SYMBOLS:
|
||||
- --stag : search bookmarks by a tag, or list all tags alphabetically with usage count (if no arguments).
|
||||
- Search results are indexed serially. This index is different from actual database index of a bookmark record which is shown within `[]` after the title.
|
||||
- **Import**:
|
||||
- URLs starting with `place:`, `file://` and `apt://` are ignored during import.
|
||||
- URLs starting with `place:`, `file://` and `apt:` are ignored during import.
|
||||
- **Encryption** is optional and manual. AES256 algorithm is used. To use encryption, the database file should be unlocked (-k) before using `buku` and locked (-l) afterwards. Between these 2 operations, the database file lies unencrypted on the disk, and NOT in memory. Also, note that the database file is *unencrypted on creation*.
|
||||
- **Editor** support:
|
||||
- A single bookmark can be edited before adding. The editor can be set using the environment variable *EDITOR* or by explicitly specifying the editor. The latter takes preference. If -a is used along with -w, the details are populated in the editor template.
|
||||
|
2
buku.1
2
buku.1
@ -73,7 +73,7 @@ Bookmarks with immutable titles are listed with '(L)' after the title.
|
||||
.PP
|
||||
.IP 9. 4
|
||||
\fBImport\fR:
|
||||
- URLs starting with `place:`, `file://` and `apt://` are ignored during import.
|
||||
- URLs starting with `place:`, `file://` and `apt:` are ignored during import.
|
||||
.PP
|
||||
.IP 10. 4
|
||||
\fBEncryption\fR is optional and manual. AES256 algorithm is used. To use encryption, the database file should be unlocked (-k) before using \fBbuku\fR and locked (-l) afterwards. Between these 2 operations, the database file lies unencrypted on the disk, and NOT in memory. Also, note that the database file is \fBunencrypted on creation\fR.
|
||||
|
2
buku.py
2
buku.py
@ -1897,7 +1897,7 @@ def is_bad_url(url):
|
||||
def is_nongeneric_url(url):
|
||||
'''Returns true for URLs which are non-http and non-generic'''
|
||||
|
||||
ignored_prefix = ['place:', 'file://', 'apt://']
|
||||
ignored_prefix = ['place:', 'file://', 'apt:']
|
||||
|
||||
for prefix in ignored_prefix:
|
||||
if url.startswith(prefix):
|
||||
|
@ -466,3 +466,19 @@ def test_network_handler_with_url(url, exp_res):
|
||||
buku.myproxy = None
|
||||
res = buku.network_handler(url)
|
||||
assert res == exp_res
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url, exp_res',
|
||||
[
|
||||
('http://example.com', False),
|
||||
('apt:package1,package2,package3', True),
|
||||
('apt://firefox', True),
|
||||
('file:///tmp/vim-markdown-preview.html', True),
|
||||
('place:sort=8&maxResults=10', True),
|
||||
]
|
||||
)
|
||||
def test_is_nongeneric_url(url, exp_res):
|
||||
import buku
|
||||
res = buku.is_nongeneric_url(url)
|
||||
assert res == exp_res
|
||||
|
Loading…
x
Reference in New Issue
Block a user