Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F27361898
test_integration.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
test_integration.py
View Options
# -------------------------------------------------------------
# Secretsmith :: Vault :: Client
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: BSD-2-Clause
# -------------------------------------------------------------
import
os
import
unittest
from
unittest.mock
import
patch
,
Mock
from
secretsmith.vault.client
import
from_config
class
TestIntegration
(
unittest
.
TestCase
):
@patch
(
"secretsmith.vault.client.Client"
)
def
test_full_config_with_all_options
(
self
,
mock_client
):
config
=
{
"server"
:
{
"url"
:
"https://vault.domain.tld"
,
"verify"
:
"/path/to/ca.crt"
,
"namespace"
:
"test-namespace"
,
},
"auth"
:
{
"method"
:
"token"
,
"token"
:
"s.full-test-token"
,
},
}
mock_client_instance
=
Mock
()
mock_client
.
return_value
=
mock_client_instance
from_config
(
config
)
mock_client
.
assert_called_once_with
(
url
=
"https://vault.domain.tld"
,
token
=
"s.full-test-token"
,
verify
=
"/path/to/ca.crt"
,
namespace
=
"test-namespace"
,
)
@patch
(
"secretsmith.vault.client.Client"
)
def
test_empty_config
(
self
,
mock_client
):
from_config
({})
with
patch
.
dict
(
os
.
environ
,
{},
clear
=
True
):
mock_client
.
assert_called_once_with
(
url
=
None
,
token
=
None
,
verify
=
None
,
namespace
=
None
,
)
if
__name__
==
"__main__"
:
unittest
.
main
()
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Tue, May 5, 17:12 (19 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3685309
Default Alt Text
test_integration.py (1 KB)
Attached To
Mode
rRPRT Nasqueron internal reports
Attached
Detach File
Event Timeline
Log In to Comment