feat(buildtrigger): allow use to specify dockerfile
users can only specify the folder and the dockerfile must be names "Dockerfile" this allows users to specify the file and it can be called "Dockerfile" or <some name>.Dockerfile
This commit is contained in:
parent
aa2f88d321
commit
e30cd931d1
12 changed files with 50 additions and 42 deletions
15
buildtrigger/test/test_basehandler.py
Normal file
15
buildtrigger/test/test_basehandler.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import pytest
|
||||
|
||||
from buildtrigger.basehandler import BuildTriggerHandler
|
||||
|
||||
|
||||
@pytest.mark.parametrize('input,output', [
|
||||
("Dockerfile", True),
|
||||
("server.Dockerfile", True),
|
||||
(u"Dockerfile", True),
|
||||
(u"server.Dockerfile", True),
|
||||
("bad file name", False),
|
||||
(u"bad file name", False),
|
||||
])
|
||||
def test_path_is_dockerfile(input, output):
|
||||
assert BuildTriggerHandler.path_is_dockerfile(input) == output
|
|
@ -13,12 +13,12 @@ def bitbucket_trigger():
|
|||
|
||||
|
||||
def test_list_build_subdirs(bitbucket_trigger):
|
||||
assert bitbucket_trigger.list_build_subdirs() == ['']
|
||||
assert bitbucket_trigger.list_build_subdirs() == ["/Dockerfile"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('subdir, contents', [
|
||||
('', 'hello world'),
|
||||
('somesubdir', 'hi universe'),
|
||||
('/Dockerfile', 'hello world'),
|
||||
('somesubdir/Dockerfile', 'hi universe'),
|
||||
('unknownpath', None),
|
||||
])
|
||||
def test_load_dockerfile_contents(subdir, contents):
|
||||
|
|
|
@ -68,8 +68,8 @@ def test_handle_trigger_request(github_trigger, payload, expected_error, expecte
|
|||
|
||||
|
||||
@pytest.mark.parametrize('subdir, contents', [
|
||||
('', 'hello world'),
|
||||
('somesubdir', 'hi universe'),
|
||||
('/Dockerfile', 'hello world'),
|
||||
('somesubdir/Dockerfile', 'hi universe'),
|
||||
('unknownpath', None),
|
||||
])
|
||||
def test_load_dockerfile_contents(subdir, contents):
|
||||
|
@ -86,4 +86,4 @@ def test_lookup_user(username, expected_response, github_trigger):
|
|||
|
||||
|
||||
def test_list_build_subdirs(github_trigger):
|
||||
assert github_trigger.list_build_subdirs() == ['', 'somesubdir']
|
||||
assert github_trigger.list_build_subdirs() == ['Dockerfile', 'somesubdir/Dockerfile']
|
||||
|
|
|
@ -13,12 +13,12 @@ def gitlab_trigger():
|
|||
|
||||
|
||||
def test_list_build_subdirs(gitlab_trigger):
|
||||
assert gitlab_trigger.list_build_subdirs() == ['']
|
||||
assert gitlab_trigger.list_build_subdirs() == ['/Dockerfile']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('subdir, contents', [
|
||||
('', 'hello world'),
|
||||
('somesubdir', 'hi universe'),
|
||||
('/Dockerfile', 'hello world'),
|
||||
('somesubdir/Dockerfile', 'hi universe'),
|
||||
('unknownpath', None),
|
||||
])
|
||||
def test_load_dockerfile_contents(subdir, contents):
|
||||
|
|
Reference in a new issue