Beispiel #1
0
    def setUp(self):
        self.user = create_user(
            'api_user',
            '*****@*****.**',
            'password',
            is_superuser=True
        )
        self.puppet_cv = "v%s" % random.randrange(0, 1000)
        self.post_data_puppet = {
            'configuration_version': self.puppet_cv,
            'host': 's11111.dc2',
            'kind': 'apply',
            'status': 'failed',
            'time': '2012-11-14 13:00:00',
        }

        self.git_changeset = "change:%s" % random.randrange(0, 1000)
        self.git_comment = "comment:%s" % random.randrange(0, 1000)
        self.post_data_git = {
            'author': 'Jan Kowalski',
            'changeset': self.git_changeset,
            'comment': self.git_comment,
            'file_paths': '/some/path',
        }

        temp_venture = Venture.objects.create(name='TempTestVenture')
        if settings.AUTOCI:
            self.ci = CI.get_by_content_object(temp_venture)
        else:
            CIImporter().import_single_object(temp_venture)
            self.ci = CI.objects.create(
                name='TempTestVentureCI',
                uid=CI.get_uid_by_content_object(temp_venture),
                type_id=4,
            )

        self.cmdb_new_value = 'nv_%s' % random.randrange(0, 1000)
        self.cmdb_old_value = 'ov_%s' % random.randrange(0, 1000)
        self.post_data_cmdb_change = {
            'ci': '/api/v0.9/ci/%d/' % self.ci.pk,
            'comment': 'test api',
            'field_name': 'child',
            'new_value': self.cmdb_new_value,
            'old_value': self.cmdb_old_value,
            'time': '2012-11-15 12:00:00',
        }
        cache.clear()
Beispiel #2
0
    def setUp(self):
        self.user = create_user(
            'api_user',
            '*****@*****.**',
            'password',
            is_superuser=True
        )
        self.puppet_cv = "v%s" % random.randrange(0, 1000)
        self.post_data_puppet = {
            'configuration_version': self.puppet_cv,
            'host': 's11111.dc2',
            'kind': 'apply',
            'status': 'failed',
            'time': '2012-11-14 13:00:00',
        }

        self.git_changeset = "change:%s" % random.randrange(0, 1000)
        self.git_comment = "comment:%s" % random.randrange(0, 1000)
        self.post_data_git = {
            'author': 'Jan Kowalski',
            'changeset': self.git_changeset,
            'comment': self.git_comment,
            'file_paths': '/some/path',
        }

        temp_venture = Venture.objects.create(name='TempTestVenture')
        if settings.AUTOCI:
            self.ci = CI.get_by_content_object(temp_venture)
        else:
            CIImporter().import_single_object(temp_venture)
            self.ci = CI.objects.create(
                name='TempTestVentureCI',
                uid=CI.get_uid_by_content_object(temp_venture),
                type_id=4,
            )

        self.cmdb_new_value = 'nv_%s' % random.randrange(0, 1000)
        self.cmdb_old_value = 'ov_%s' % random.randrange(0, 1000)
        self.post_data_cmdb_change = {
            'ci': '/api/v0.9/ci/%d/' % self.ci.pk,
            'comment': 'test api',
            'field_name': 'child',
            'new_value': self.cmdb_new_value,
            'old_value': self.cmdb_old_value,
            'time': '2012-11-15 12:00:00',
        }
        cache.clear()
Beispiel #3
0
    def setUp(self):
        self.puppet_cv = "v%s" % random.randrange(0, 1000)
        puppet_bundle = Bundle(
            data={
                'configuration_version': self.puppet_cv,
                'host': 's11111.dc2',
                'kind': 'apply',
                'status': 'failed',
                'time': '2012-11-14 13:00:00'
            })
        puppet_resource = CIChangePuppetResource()
        puppet_resource.obj_create(bundle=puppet_bundle)

        self.git_changeset = "change:%s" % random.randrange(0, 1000)
        self.git_comment = "comment:%s" % random.randrange(0, 1000)
        git_bundle = Bundle(
            data={
                'author': 'Jan Kowalski',
                'changeset': self.git_changeset,
                'comment': self.git_comment,
                'file_paths': '/some/path',
            })
        git_resource = CIChangeGitResource()
        git_resource.obj_create(bundle=git_bundle)

        temp_venture = Venture.objects.create(name='TempTestVenture')
        self.ci = CI.objects.create(
            name='TempTestVentureCI',
            uid=CI.get_uid_by_content_object(temp_venture),
            type_id=4)
        self.cmdb_new_value = 'nv_%s' % random.randrange(0, 1000)
        self.cmdb_old_value = 'ov_%s' % random.randrange(0, 1000)
        cmdb_bundle = Bundle(
            data={
                'ci': '/api/v0.9/ci/%d/' % self.ci.pk,
                'comment': 'test api',
                'field_name': 'child',
                'new_value': self.cmdb_new_value,
                'old_value': self.cmdb_old_value,
                'time': '2012-11-15 12:00:00'
            })
        cmdb_resource = CIChangeCMDBHistoryResource()
        cmdb_resource.obj_create(bundle=cmdb_bundle)
Beispiel #4
0
    def setUp(self):
        self.user = create_user("api_user", "*****@*****.**", "password", is_superuser=True)
        self.puppet_cv = "v%s" % random.randrange(0, 1000)
        self.post_data_puppet = {
            "configuration_version": self.puppet_cv,
            "host": "s11111.dc2",
            "kind": "apply",
            "status": "failed",
            "time": "2012-11-14 13:00:00",
        }

        self.git_changeset = "change:%s" % random.randrange(0, 1000)
        self.git_comment = "comment:%s" % random.randrange(0, 1000)
        self.post_data_git = {
            "author": "Jan Kowalski",
            "changeset": self.git_changeset,
            "comment": self.git_comment,
            "file_paths": "/some/path",
        }

        temp_venture = Venture.objects.create(name="TempTestVenture")
        if settings.AUTOCI:
            self.ci = CI.get_by_content_object(temp_venture)
        else:
            CIImporter().import_single_object(temp_venture)
            self.ci = CI.objects.create(
                name="TempTestVentureCI", uid=CI.get_uid_by_content_object(temp_venture), type_id=4
            )

        self.cmdb_new_value = "nv_%s" % random.randrange(0, 1000)
        self.cmdb_old_value = "ov_%s" % random.randrange(0, 1000)
        self.post_data_cmdb_change = {
            "ci": "/api/v0.9/ci/%d/" % self.ci.pk,
            "comment": "test api",
            "field_name": "child",
            "new_value": self.cmdb_new_value,
            "old_value": self.cmdb_old_value,
            "time": "2012-11-15 12:00:00",
        }
        cache.clear()