This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/endpoints/api/test/test_build.py
Charlton Austin 63a2f0c14b feat(add dockerfile_path to build api): added in a dockerfile to specify path
### Description of Changes

  this allows people to specify a context and a dockerfile path
2017-03-30 16:30:00 -04:00

20 lines
953 B
Python

import pytest
from endpoints.api.build import RepositoryBuildList
@pytest.mark.parametrize('request_json,subdir,context', [
({}, '/Dockerfile', '/'),
({'context': '/some_context'}, '/some_context/Dockerfile', '/some_context'),
({'subdirectory': 'some_context'}, 'some_context/Dockerfile', 'some_context'),
({'subdirectory': 'some_context/'}, 'some_context/Dockerfile', 'some_context/'),
({'dockerfile_path': 'some_context/Dockerfile'}, 'some_context/Dockerfile', 'some_context'),
({'dockerfile_path': 'some_context/Dockerfile', 'context': '/'}, 'some_context/Dockerfile', '/'),
({'dockerfile_path': 'some_context/Dockerfile',
'context': '/',
'subdirectory': 'slime'}, 'some_context/Dockerfile', '/'),
])
def test_extract_dockerfile_args(request_json, subdir, context):
actual_context, actual_subdir = RepositoryBuildList.get_dockerfile_context(request_json)
assert subdir == actual_subdir
assert context == actual_context