27 lines
580 B
Python
27 lines
580 B
Python
from hbd.server import oauth
|
|
|
|
|
|
CFG_OFF = {}
|
|
CFG_ON = {
|
|
"oauth": {
|
|
"gitea": {
|
|
"url": "https://git.example.com",
|
|
"client_id": "cid",
|
|
"client_secret": "csec",
|
|
}
|
|
}
|
|
}
|
|
CFG_PARTIAL = {"oauth": {"gitea": {"url": "https://git.example.com"}}}
|
|
|
|
|
|
def test_is_enabled_when_all_keys_present():
|
|
assert oauth.is_enabled(CFG_ON) is True
|
|
|
|
|
|
def test_is_enabled_false_when_no_oauth_key():
|
|
assert oauth.is_enabled(CFG_OFF) is False
|
|
|
|
|
|
def test_is_enabled_false_when_partial_config():
|
|
assert oauth.is_enabled(CFG_PARTIAL) is False
|