예제 #1
0
    def test_default_version_is_not_in_manifest(self):
        exception = None

        input_dict = utils.FormattedDict()
        input_dict['BP_DIR'] = buildpack_directory()
        create_manifest_file(self.manifest_file, BAD_MANIFEST)

        try:
            CloudFoundryUtil.update_default_version('php', self.manifest_file, input_dict)
        except RuntimeError as e:
            exception = e

        eq_("Error detecting PHP default version", str(exception))
    def test_default_version_is_not_in_manifest(self):
        exception = None

        input_dict = utils.FormattedDict()
        input_dict['BP_DIR'] = buildpack_directory()
        create_manifest_file(self.manifest_file, BAD_MANIFEST)

        try:
            CloudFoundryUtil.update_default_version('php', self.manifest_file, input_dict)
        except RuntimeError as e:
            exception = e

        eq_("Error detecting PHP default version", str(exception))
예제 #3
0
    def test_default_versions_are_updated(self):
        input_dict = utils.FormattedDict()
        input_dict['BP_DIR'] = buildpack_directory()
        create_manifest_file(self.manifest_file, GOOD_MANIFEST)

        output_dict = CloudFoundryUtil.update_default_version('php', self.manifest_file, input_dict)

        # keys exist
        eq_('PHP_VERSION' in output_dict, True)
        eq_('PHP_DOWNLOAD_URL' in output_dict, True)
        eq_('PHP_MODULES_PATTERN' in output_dict, True)

        # have correct value
        eq_(output_dict['PHP_VERSION'], '9.9.99')

        # output_dict['PHP_VERSION'] + output_dict['MODULE_NAME'] are interpolated into the strings returned
        # from the dict, so:
        output_dict['MODULE_NAME'] = 'test_default_versions'
        eq_(output_dict['PHP_MODULES_PATTERN'], '/php/9.9.99/php-test_default_versions-9.9.99.tar.gz')
        eq_(output_dict['PHP_DOWNLOAD_URL'], '/php/9.9.99/php-9.9.99.tar.gz')
    def test_default_versions_are_updated(self):
        input_dict = utils.FormattedDict()
        input_dict['BP_DIR'] = buildpack_directory()
        create_manifest_file(self.manifest_file, GOOD_MANIFEST)

        output_dict = CloudFoundryUtil.update_default_version('php', self.manifest_file, input_dict)

        # keys exist
        eq_('PHP_VERSION' in output_dict, True)
        eq_('PHP_DOWNLOAD_URL' in output_dict, True)
        eq_('PHP_MODULES_PATTERN' in output_dict, True)

        # have correct value
        eq_(output_dict['PHP_VERSION'], '9.9.99')

        # output_dict['PHP_VERSION'] + output_dict['MODULE_NAME'] are interpolated into the strings returned
        # from the dict, so:
        output_dict['MODULE_NAME'] = 'test_default_versions'
        eq_(output_dict['PHP_MODULES_PATTERN'], '/php/9.9.99/php-test_default_versions-9.9.99.tar.gz')
        eq_(output_dict['PHP_DOWNLOAD_URL'], '/php/9.9.99/php-9.9.99.tar.gz')