-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add util functions to generate qr codes for urls
- Loading branch information
1 parent
35f1a9b
commit 68a368d
Showing
4 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add functionality to create QR codes to a given url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import io | ||
|
||
from nav.web.utils import generate_qr_code, generate_qr_codes_as_byte_strings | ||
|
||
|
||
def test_generate_qr_code_returns_byte_buffer(): | ||
qr_code = generate_qr_code(url="www.example.com", name="buick.lab.uninett.no") | ||
assert isinstance(qr_code, io.BytesIO) | ||
|
||
|
||
def test_generate_qr_codes_as_byte_strings_returns_list_of_byte_strings(): | ||
qr_codes = generate_qr_codes_as_byte_strings( | ||
{"buick.lab.uninett.no": "www.example.com"} | ||
) | ||
assert isinstance(qr_codes, list) | ||
assert isinstance(qr_codes[0], str) |