Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
21cac5da
Commit
21cac5da
authored
Aug 30, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: check that unreachable schema issue a warning
parent
c434c04b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
slapos/tests/test_util.py
slapos/tests/test_util.py
+11
-2
No files found.
slapos/tests/test_util.py
View file @
21cac5da
...
@@ -32,6 +32,7 @@ import shutil
...
@@ -32,6 +32,7 @@ import shutil
import
tempfile
import
tempfile
import
textwrap
import
textwrap
import
unittest
import
unittest
import
warnings
from
pwd
import
getpwnam
from
pwd
import
getpwnam
from
six.moves
import
SimpleHTTPServer
from
six.moves
import
SimpleHTTPServer
...
@@ -458,11 +459,19 @@ class TestSoftwareReleaseSchemaEdgeCases(unittest.TestCase):
...
@@ -458,11 +459,19 @@ class TestSoftwareReleaseSchemaEdgeCases(unittest.TestCase):
def
test_software_schema_file_not_exist
(
self
):
def
test_software_schema_file_not_exist
(
self
):
schema
=
SoftwareReleaseSchema
(
'/file/not/exist'
,
None
)
schema
=
SoftwareReleaseSchema
(
'/file/not/exist'
,
None
)
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
warnings
.
simplefilter
(
"always"
)
self
.
assertIsNone
(
schema
.
getSoftwareSchema
())
self
.
assertIsNone
(
schema
.
getSoftwareSchema
())
self
.
assertEqual
(
len
(
w
),
1
)
self
.
assertIn
(
"Unable to load JSON"
,
str
(
w
[
0
].
message
))
def
test_software_schema_wrong_URL
(
self
):
def
test_software_schema_wrong_URL
(
self
):
schema
=
SoftwareReleaseSchema
(
'http://slapos.invalid/software.cfg'
,
None
)
schema
=
SoftwareReleaseSchema
(
'http://slapos.invalid/software.cfg'
,
None
)
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
warnings
.
simplefilter
(
"always"
)
self
.
assertIsNone
(
schema
.
getSoftwareSchema
())
self
.
assertIsNone
(
schema
.
getSoftwareSchema
())
self
.
assertEqual
(
len
(
w
),
1
)
self
.
assertIn
(
"Unable to load JSON"
,
str
(
w
[
0
].
message
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment