Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cb-util
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christoph Alt
cb-util
Commits
fb6afa95
Commit
fb6afa95
authored
1 year ago
by
Razvan Vass
Browse files
Options
Downloads
Patches
Plain Diff
You must to have .env in the main folder
parent
ff7ba139
No related branches found
No related tags found
1 merge request
!9
You must to have .env in the main folder
Pipeline
#65134
passed
1 year ago
Stage: test
Stage: deploy
Stage: trigger
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_dashboard_upload.py
+3
-3
3 additions, 3 deletions
tests/test_dashboard_upload.py
with
3 additions
and
3 deletions
tests/test_dashboard_upload.py
+
3
−
3
View file @
fb6afa95
...
...
@@ -7,16 +7,16 @@ import os
def
test_load_config_from_env
():
# Case 1: Test if function raises exception for missing GRAFANA_API_KEY
with
pytest
.
raises
(
ValueError
)
as
e
:
load_config_from_env
(
env_path
=
"
.env
"
)
load_config_from_env
(
env_path
=
"
.
./.
env
"
)
assert
str
(
e
.
value
)
==
"
GRAFANA_API_KEY is None or not defined in the .env file
"
# Case 2: Test if function raises exception for missing GRAFANA_SERVER
with
patch
.
dict
(
os
.
environ
,
{
"
GRAFANA_API_KEY
"
:
"
api_key
"
}):
with
pytest
.
raises
(
ValueError
)
as
e
:
load_config_from_env
(
env_path
=
"
.env
"
)
load_config_from_env
(
env_path
=
"
.
./.
env
"
)
assert
str
(
e
.
value
)
==
"
GRAFANA_SERVER is None or not defined in the .env file
"
# Case 3: Test if function returns expected values when both variables are defined
with
patch
.
dict
(
os
.
environ
,
{
"
GRAFANA_API_KEY
"
:
"
api_key
"
,
"
GRAFANA_SERVER
"
:
"
server_url
"
}):
result
=
load_config_from_env
(
env_path
=
"
.env
"
)
result
=
load_config_from_env
(
env_path
=
"
.
./.
env
"
)
assert
result
==
(
"
server_url
"
,
"
api_key
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment