def test_parses_add(self, mock_delegate): parser.parse_dockerfile_with_delegate(self.add_dockerfile_stream, mock_delegate) assert mock_delegate.has_calls([ mock.call.run_add('foo', 'bar'), mock.call.run_add('foo', '.'), mock.call.run_add('http://www.me.com?foo=bar', 'hello.txt') ])
def test_parses_env(self, mock_delegate): parser.parse_dockerfile_with_delegate(self.env_dockerfile_stream, mock_delegate) assert mock_delegate.has_calls([ mock.call.run_env('FOO', 'BAR'), mock.call.run_env('HOME', '/root'), mock.call.run_env('TZ', ':America/New_York'), mock.call.run_env('LANG', 'EN.UTF-8'), mock.call.run_env('ME_BASE_HOME', '/usr/src/me-base') ])
def test_parses_run(self, mock_delegate): parser.parse_dockerfile_with_delegate(self.run_dockerfile_stream, mock_delegate) assert mock_delegate.has_calls([ mock.call.run_run('apt-get update'), mock.call.run_run( 'apt-get upgrade --assume-yes --verbose-versions ' '--option Dpkg::Options::="--force-confold" && apt-get install ' '--assume-yes --verbose-versions apt-utils ' 'binfmt-support build-essential curl ' 'dnsutils git htop iftop ' 'iotop iputils-ping libssl-dev lsof ' 'man mlocate netcat pkg-config ' 'rsync strace sudo tcpdump ' 'telnet tzdata vim wget') ])
def test_parses_misc(self, mock_delegate): parser.parse_dockerfile_with_delegate(self.misc_dockerfile_stream, mock_delegate) assert mock_delegate.has_calls([ mock.call.run_nop(), mock.call.run_nop(), mock.call.run_unknown('FROM phusion/passenger-full:1.0.6'), mock.call.run_unknown('LABEL maintainer "Me <*****@*****.**>"'), mock.call.run_nop(), mock.call.run_unknown('ARG DEBIAN_FRONTEND=noninteractive'), mock.call.run_nop(), mock.call.run_unknown('VOLUME $PIP_OVERRIDE_DIR'), mock.call.run_unknown('CMD ["/sbin/my_init"]'), mock.call.run_nop(), mock.call.run_nop(), mock.call.run_skip() ])
def test_can_parse(self): parser.parse_dockerfile_with_delegate(self.example_dockerfile_stream, self.target)
def test_parses_workdir(self, mock_delegate): parser.parse_dockerfile_with_delegate(self.workdir_dockerfile_stream, mock_delegate) assert mock_delegate.has_calls( [mock.call.run_workdir('/home/docker/app')], [mock.call.run_workdir('/home/docker/app')])
def test_parses_copy(self, mock_delegate): parser.parse_dockerfile_with_delegate(self.copy_dockerfile_stream, mock_delegate) assert mock_delegate.has_calls( [mock.call.run_copy('foo', 'bar'), mock.call.run_copy('foo', '.')])
def test_can_parse(self): parser.parse_dockerfile_with_delegate(self.example_dockerfile_stream, parser.AbstractParserDelegate())