def test_prepare_deploy_params(self, mocked): mocked.return_value = ['a1f', 'abc', 'spi-der'] with FakeProjectDirectory() as tmpdir: add_fake_setup_py(tmpdir) assert _prepare_deploy_params( 123, 'test-vers', 'registry/user/project', 'endpoint', 'apikey', None, None, None) == { 'image_url': 'registry/user/project', 'project': 123, 'pull_insecure_registry': True, 'scripts': 'scriptA.py,scriptB.py', 'spiders': 'a1f,abc,spi-der', 'version': 'test-vers'}
def test_prepare_deploy_params_more_params(self, mocked): mocked.return_value = ['a1f', 'abc', 'spi-der'] with FakeProjectDirectory() as tmpdir: add_fake_setup_py(tmpdir) expected_auth = ('{"email": "email@mail", "password":'******' "pass", "username": "******"}') assert _prepare_deploy_params( 123, 'test-vers', 'registry/user/project', 'endpoint', 'apikey', 'user', 'pass', 'email@mail') == { 'image_url': 'registry/user/project', 'project': 123, 'pull_auth_config': expected_auth, 'scripts': 'scriptA.py,scriptB.py', 'spiders': 'a1f,abc,spi-der', 'version': 'test-vers'}
def test_prepare_deploy_params(mocked): mocked.return_value = { 'project_type': 'scrapy', 'spiders': ['a1f', 'abc', 'spi-der']} expected = { 'project_type': 'scrapy', 'image_url': 'registry.io/user/project', 'project': 123, 'pull_insecure_registry': True, 'scripts': 'scriptA.py,scriptB.py', 'spiders': 'a1f,abc,spi-der', 'version': 'test-vers', } assert _prepare_deploy_params( 123, 'test-vers', 'registry.io/user/project', 'endpoint', 'apikey', None, None, None) == expected
def test_prepare_deploy_params_more_params(mocked): mocked.return_value = { 'project_type': 'scrapy', 'spiders': ['a1f', 'abc', 'spi-der'], } expected = { 'project_type': 'scrapy', 'image_url': 'registry.io/user/project', 'project': 123, 'scripts': 'scriptA.py,scriptB.py', 'spiders': 'a1f,abc,spi-der', 'version': 'test-vers', 'pull_auth_config': '{"email": "email@mail", "password": "******", "username": "******"}', } assert _prepare_deploy_params( 123, 'test-vers', 'registry.io/user/project', 'endpoint', 'apikey', 'user', 'pass', 'email@mail') == expected