Exemple #1
0
    def _create_project(self):
        # Bare bones project
        project = models.Project()
        project.name = 'TEST_PROJECT'
        project.description = 'TEST_DESCRIPTION'

        project.save()

        # Bare bones stage
        stage = models.Stage()
        stage.project = project
        stage.name = 'Production'
        stage.save()

        self.stage = stage

        # Bare bones configuration
        configuration = models.Configuration()
        configuration.project = project
        configuration.stage = stage
        configuration.key = 'KEY'
        configuration.value = 'VALUE'
        configuration.prompt_me_for_input = True
        configuration.save()

        self.configuration = configuration

        # Bare bones task
        task = models.Task()
        task.name = 'TASK_NAME'
        task.save()

        self.task = task

        # Bare bones deployment
        deployment = models.Deployment()
        deployment.user = self.user
        deployment.stage = stage
        deployment.comments = 'COMMENTS'
        deployment.output = 'OUTPUT'
        deployment.task = task
        deployment.save()

        # Setup Hook
        hook = hook_models.Hook()
        hook.url = 'http://example.com'
        hook.save()

        project_hook = hook_models.Hook()
        project_hook.url = 'http://example.com/project/hook/'
        project_hook.project = project
        project_hook.save()

        self.deployment = deployment

        self.hook = hook
        self.project_hook = project_hook

        self.project = project
Exemple #2
0
    def test_stage_configuration_cram_a_lam(self):
        """Let's make sure our configuration mashing together works as expected"""
        project_configs = [
            {'key': 'number1', 'value': '100'},
            {'key': 'number2', 'value': '200'},
            {'key': 'number3', 'value': '300'},
            {'key': 'number4', 'value': '400'},
        ]

        for config in project_configs:
            c = models.Configuration()
            c.project = self.project
            c.key = config['key']
            c.value = config['value']
            c.save()

        configurations_round_one = self.stage.get_configurations()

        # These should be what we're expecting
        self.assertEqual(configurations_round_one['number1'].get_value(), '100')
        self.assertEqual(configurations_round_one['number2'].get_value(), '200')
        self.assertEqual(configurations_round_one['number3'].get_value(), '300')
        self.assertEqual(configurations_round_one['number4'].get_value(), '400')

        stage_configs = [

            {'key': 'number2', 'value': '5'},
            {'key': 'number3', 'value': '4'},
            {'key': 'number4', 'value': '3'},
        ]

        for config in stage_configs:
            c = models.Configuration()
            c.project = self.project
            c.stage = self.stage
            c.key = config['key']
            c.value = config['value']
            c.save()

        configurations = self.stage.get_configurations()

        # The stage configs take the cake over project configs
        self.assertEqual(configurations['number1'].get_value(), '100')
        self.assertEqual(configurations['number2'].get_value(), '5')
        self.assertEqual(configurations['number3'].get_value(), '4')
        self.assertEqual(configurations['number4'].get_value(), '3')
Exemple #3
0
    def _create_project(self):

        # Bare bones project type
        project_type = models.ProjectType()
        project_type.name = 'Django'
        self.project_type = project_type.save()

        # Bare bones project
        project = models.Project()
        project.name = 'TEST_PROJECT'
        project.type = project_type
        project.description = 'TEST_DESCRIPTION'

        project.save()

        # Bare bones stage
        stage = models.Stage()
        stage.project = project
        stage.name = 'Production'
        stage.save()

        self.stage = stage

        # Bare bones configuration
        configuration = models.Configuration()
        configuration.project = project
        configuration.stage = stage
        configuration.key = 'KEY'
        configuration.value = 'VALUE'
        configuration.prompt_me_for_input = True
        configuration.save()

        self.configuration = configuration

        # Bare bones task
        task = models.Task()
        task.name = 'TASK_NAME'
        task.save()

        self.task = task

        # Bare bones deployment
        deployment = models.Deployment()
        deployment.user = self.user
        deployment.stage = stage
        deployment.comments = 'COMMENTS'
        deployment.output = 'OUTPUT'
        deployment.task = task
        deployment.save()

        self.deployment = deployment

        self.project = project