-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:release-engineering/ubi-config
- Loading branch information
Showing
16 changed files
with
398 additions
and
325 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
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
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,32 @@ | ||
from mock import patch, MagicMock, Mock | ||
import pytest | ||
import yaml | ||
|
||
from ubiconfig._impl.loaders import GitlabLoader | ||
|
||
|
||
def mock_json(value): | ||
out = MagicMock() | ||
out.json.return_value = value | ||
return out | ||
|
||
|
||
def test_bad_yaml(): | ||
with patch('requests.Session') as mock_session_class: | ||
session = mock_session_class.return_value | ||
session.get.side_effect = [ | ||
# branches | ||
mock_json([{'name': 'master'}]), | ||
|
||
# files | ||
mock_json([{'name': 'badfile.yaml', 'path': 'badfile.yaml'}]), | ||
|
||
# content (not valid yaml!) | ||
Mock(content='[oops not yaml'), | ||
] | ||
|
||
loader = GitlabLoader('https://some-repo.example.com/foo/bar') | ||
|
||
# It should propagate the YAML load exception | ||
with pytest.raises(yaml.YAMLError): | ||
loader.load('badfile.yaml') |
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,15 @@ | ||
from pytest import raises | ||
|
||
from ubiconfig import Loader | ||
|
||
|
||
def test_no_load(): | ||
"""load must be implemented in subclass""" | ||
with raises(NotImplementedError): | ||
Loader().load('something.yaml') | ||
|
||
|
||
def test_no_load_all(): | ||
"""load_all must be implemented in subclass""" | ||
with raises(NotImplementedError): | ||
Loader().load_all() |
Oops, something went wrong.