<commit_before>"""def generate_deployment_templates(template_type, values, datetimestamp):
def generate_forseti_conf(template_type, vals, datetimestamp):
def copy_file_to_destination(file_path, output_path,
                             is_directory, dry_run):
def generate_file_from_template(template_path, output_path, template_values):
def sanitize_conf_values(conf_values):
"""
import unittest

import setup.gcp.installer.util.utils as utils

from tests.unittest_utils import ForsetiTestCase


class UtilsModuleTest(ForsetiTestCase):

    def test_id_from_name_normal(self):
        """The name of the resource, formatted as
        ${RESOURCE_TYPE}/${RESOURCE_ID}, make ${RESOURCE_ID} is returned"""
        test_name = 'RESOURCE_TYPE/RESOURCE_ID'
        expected_name = 'RESOURCE_ID'
        self.assertTrue(utils.id_from_name(test_name), expected_name)

    def test_id_from_name_multiple_backslashes(self):
        """The name of the resource, formatted as
        ${RESOURCE_TYPE}/${RESOURCE_ID}, make ${RESOURCE_ID} is returned"""
        test_name = 'RESOURCE_TYPE1/RESOUCE_TYPE2/RESOURCE_TYPE3/RESOURCE_ID'
        expected_name = 'RESOURCE_ID'
        self.assertTrue(utils.id_from_name(test_name), expected_name)

    def test_id_from_name_no_backslash(self):
        """The name of the resource, formatted as
        ${RESOURCE_TYPE}/${RESOURCE_ID}, make ${RESOURCE_ID} is returned"""
        test_name = 'RESOURCE_ID'
        expected_name = 'RESOURCE_ID'
        self.assertTrue(utils.id_from_name(test_name), expected_name)

    def test_extract_timestamp_from_instance_name_name_is_none(self):
        """Instance_name is None"""
        timestamp = utils.extract_timestamp_from_instance_name(None)
        expected_timestamp = ''
        self.assertEqual(timestamp, expected_timestamp)

    def test_extract_timestamp_from_instance_name_normal_incl_date(self):
        """Normal instance_name, include_date is true"""
        instance_name = 'forseti-security-server-20180207125916-vm'
        timestamp = utils.extract_timestamp_from_instance_name(instance_name,
                                                               True)
        expected_timestamp = '20180207125916'
        self.assertEqual(timestamp, expected_timestamp)

    def test_extract_timestamp_from_instance_name_normal_not_incl_date(self):
        """Normal instance_name, include_date is true"""
        instance_name = 'forseti-security-server-20180207125916-vm'
        timestamp = utils.extract_timestamp_from_instance_name(instance_name,
                                                               False)
        expected_timestamp = '125916'
        self.assertEqual(timestamp, expected_timestamp)

    def test_sanitize_conf_values_normal_input(self):
        """Normal config values"""
        input_conf = {
            'apple': '12',
            'orange': '5',
            'banana': ''<commit_msg>removed unnecessary unit tests<commit_after>"""def generate_deployment_templates(template_type, values, datetimestamp):
def generate_forseti_conf(template_type, vals, datetimestamp):
def copy_file_to_destination(file_path, output_path,
                             is_directory, dry_run):
def generate_file_from_template(template_path, output_path, template_values):
def sanitize_conf_values(conf_values):
"""
import unittest

import setup.gcp.installer.util.utils as utils

from tests.unittest_utils import ForsetiTestCase


class UtilsModuleTest(ForsetiTestCase):

    def test_id_from_name_normal(self):
        """The name of the resource, formatted as
        ${RESOURCE_TYPE}/${RESOURCE_ID}, make ${RESOURCE_ID} is returned"""
        test_name = 'RESOURCE_TYPE/RESOURCE_ID'
        expected_name = 'RESOURCE_ID'
        self.assertTrue(utils.id_from_name(test_name), expected_name)

    def test_id_from_name_multiple_backslashes(self):
        """The name of the resource, formatted as
        ${RESOURCE_TYPE}/${RESOURCE_ID}, make ${RESOURCE_ID} is returned"""
        test_name = 'RESOURCE_TYPE1/RESOUCE_TYPE2/RESOURCE_TYPE3/RESOURCE_ID'
        expected_name = 'RESOURCE_ID'
        self.assertTrue(utils.id_from_name(test_name), expected_name)

    def test_id_from_name_no_backslash(self):
        """The name of the resource, formatted as
        ${RESOURCE_TYPE}/${RESOURCE_ID}, make ${RESOURCE_ID} is returned"""
        test_name = 'RESOURCE_ID'
        expected_name = 'RESOURCE_ID'
        self.assertTrue(utils.id_from_name(test_name), expected_name)

    def test_sanitize_conf_values_normal_input(self):
        """Normal config values"""
        input_conf = {
            'apple': '12',
            'orange': '5',
            'banana': ''
{'fraction_non_alphanumeric': 0.09172738962708958, 'fraction_numerical': 0.012858979854264894, 'mean_word_length': 3.5310679611650486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2487964', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1373, 'n_words': 249}