Пример #1
0
 def setUp(self):
     self.user = create_user('api_user', '*****@*****.**', 'password')
     self.layers = CILayer.objects.all()
     self.types = CIType.objects.all()
     self.create_owners()
     self.create_cis()
     self.create_ownerships()
     self.create_relations()
     self.data = {
         'format': 'json',
         'username': self.user.username,
         'api_key': self.user.api_key.key
     }
     cache.delete("api_user_accesses")
Пример #2
0
 def setUp(self):
     self.user = create_user(
         'api_user',
         '*****@*****.**',
         'password',
         is_staff=False,
         is_superuser=False,
     )
     self.api_login = {
         'format': 'json',
         'username': self.user.username,
         'api_key': self.user.api_key.key,
     }
     cache.delete("api_user_accesses")
Пример #3
0
 def setUp(self):
     self.user = create_user("api_user", "*****@*****.**", "password")
     self.layers = CILayer.objects.all()
     self.types = CIType.objects.all()
     self.create_owners()
     self.create_cis()
     self.create_ownerships()
     self.create_attributes()
     self.create_relations()
     self.headers = {
         "HTTP_ACCEPT": "application/json",
         "HTTP_AUTHORIZATION": "ApiKey {}:{}".format(self.user.username, self.user.api_key.key),
     }
     cache.delete("api_user_accesses")
Пример #4
0
 def setUp(self):
     self.user = create_user(
         'api_user',
         '*****@*****.**',
         'password',
         is_staff=False,
         is_superuser=False,
     )
     self.api_login = {
         'format': 'json',
         'username': self.user.username,
         'api_key': self.user.api_key.key,
     }
     cache.delete("api_user_accesses")
Пример #5
0
 def setUp(self):
     self.user = create_user('api_user', '*****@*****.**', 'password')
     self.layers = CILayer.objects.all()
     self.types = CIType.objects.all()
     self.create_owners()
     self.create_cis()
     self.create_ownerships()
     self.create_relations()
     self.data = {
         'format': 'json',
         'username': self.user.username,
         'api_key': self.user.api_key.key
     }
     cache.delete("api_user_accesses")
Пример #6
0
 def setUp(self):
     self.user = create_user('api_user', '*****@*****.**', 'password')
     self.layers = CILayer.objects.all()
     self.types = CIType.objects.all()
     self.create_owners()
     self.create_cis()
     self.create_ownerships()
     self.create_attributes()
     self.create_relations()
     self.headers = {
         'HTTP_ACCEPT':
         'application/json',
         'HTTP_AUTHORIZATION':
         'ApiKey {}:{}'.format(self.user.username, self.user.api_key.key),
     }
     cache.delete("api_user_accesses")
Пример #7
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()
Пример #8
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()
Пример #9
0
 def setUp(self):
     super(TestChangeIPAddress, self).setUp()
     self.user = create_user()
     self.sample_dev = DeviceFactory()
     self.sample_ip_1 = IPAddressFactory(
         address="10.0.1.1", device=self.sample_dev,
         hostname="d001.dc",
     )
     self.sample_dhcp_entry_1 = DHCPEntryFactory(
         ip="10.0.1.1",
         mac="aa:cc:bb:11:22:33",
     )
     self.sample_dns_domain = DNSDomainFactory(name='dc')
     self.sample_dns_record = DNSRecordFactory(
         name='d001.dc',
         type='A',
         content='10.0.1.1',
         domain=self.sample_dns_domain,
     )
Пример #10
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()
Пример #11
0
 def setUp(self):
     self.user = create_user("api_user", "*****@*****.**", "password", is_staff=False, is_superuser=False)
     self.api_login = {"format": "json", "username": self.user.username, "api_key": self.user.api_key.key}
     cache.delete("api_user_accesses")