def test_save_none(self):
     mock = self.mock_valid()
     mock["nome"] = "InterfaceNone"
     mock[self.KEY_ATTR] = self.NONE_ATTR
     response = self.save({self.XML_KEY: mock})
     valid_response(response)
     valid_content(response, self.XML_KEY)
 def test_save_ipv4_valid(self):
     mock = self.mock_network_ip_valid()
     mock[self.KEY_ATTR] = 26
     response = self.client_autenticado().postXML(
         self.URL_SAVE_NETWORK_IPV4, {self.XML_KEY_NETWORK_IP: mock})
     valid_response(response)
     valid_content(response, self.XML_KEY_NETWORK_IP)
 def test_save_ipv6_valid(self):
     mock = self.mock_network_hosts_ip_valid()
     mock['id_vlan'] = 17
     response = self.client_autenticado().putXML(
         self.URL_SAVE_NETWORK_IPV6, {self.XML_KEY_NETWORK_IP: mock})
     valid_response(response)
     valid_content(response, self.XML_KEY_NETWORK_IP)
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        content = valid_content(response, self.XML_KEY)

        response = self.search(id_env_vip=content["id"])
        valid_response(response)
        env_vip = valid_content(response, self.XML_KEY)
        self.valid_attr(mock, env_vip)
    def test_save_networkIpv6_set_first_available_ip_valid(self):
        mock = self.mock_networkIpv6_set_first_available_ip_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        response_dict = valid_content(response, self.XML_KEY)

        response = self.client_autenticado().get(
            self.URL_GET_IPS_BY_IPV6_ID % response_dict['id'])
        valid_response(response)
        valid_content(response, self.XML_KEY_IPS_NETWORK, True)
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        group_user = valid_content(response, self.XML_KEY)

        response = self.get_by_id(group_user['id'])
        valid_response(response)
        content = valid_content(response, self.XML_KEY)
        self.valid_attr(mock, content)
Beispiel #7
0
    def test_associate_valid(self):
        response = self.client_autenticado().put(
            self.URL_ASSOCIATE % (self.ID_VALID, self.ID_TYPE_EQUIPMENT))
        valid_response(response)
        valid_content(response, "equiptype_filter_xref")

        # Remove filter association so it does not require cleaning db manually
        response = self.client_autenticado().put(
            self.URL_DISSOCIATE % (self.ID_VALID, self.ID_TYPE_EQUIPMENT))
        valid_response(response)
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        content = valid_content(response, self.XML_KEY)

        response = self.get_by_id(content["id"])
        valid_response(response)
        ovip = valid_content(response, self.XML_KEY)

        self.valid_attr(mock, ovip)
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        content = valid_content(response, "perm")

        response = self.get_by_id(content["id"])
        valid_response(response)
        perm = valid_content(response, "perm")

        self.valid_attr(mock, perm)
Beispiel #10
0
    def test_save_networkIpv6AddResource_set_first_available_ip_valid(self):
        mock = self.mock_networkIpv6AddResource_set_first_available_ip_valid()
        response = self.client_autenticado().postXML(
            self.URL_SAVE_NETWORK_IPV6, {self.XML_KEY_NETWORK_IP: mock})
        valid_response(response)
        response_dict = valid_content(response, self.XML_KEY_NETWORK_IP)

        response = self.client_autenticado().get(
            self.URL_GET_IPS_BY_IPV6_ID % response_dict['id_network'])
        valid_response(response)
        valid_content(response, self.XML_KEY_IPS_NETWORK, True)
    def test_associate_valid(self):
        response = self.client_autenticado().put(
            self.URL_ASSOCIATE % (self.ID_OPTION_VIP_FOR_ASSOCIATION, self.ID_ENV_VIP_FOR_ASSOCIATION)
        )
        valid_response(response)
        valid_content(response, "opcoesvip_ambiente_xref")

        # Dissociate so it does not require cleaning db manually
        response = self.client_autenticado().delete(
            self.URL_DISSOCIATE % (self.ID_OPTION_VIP_FOR_ASSOCIATION, self.ID_ENV_VIP_FOR_ASSOCIATION)
        )
        valid_response(response)
Beispiel #12
0
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        brand = valid_content(response, "brand")

        response = self.get_all()
        valid_response(response)
        content = valid_content(response, "brand")

        for brd in content:
            if brd["id"] == brand["id"]:
                self.valid_attr(mock, brd)
                break
Beispiel #13
0
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        script = valid_content(response, "script")

        response = self.get_all()
        valid_response(response)
        content = valid_content(response, "script")

        for scr in content:
            if scr["id"] == script["id"]:
                self.valid_attr(mock, scr)
                break
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        divisiondc = valid_content(response, "division_dc")

        response = self.get_all()
        valid_response(response)
        content = valid_content(response, "division_dc")

        for ddc in content:
            if ddc["id"] == divisiondc["id"]:
                self.valid_attr(mock, ddc)
                break
Beispiel #15
0
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        content = valid_content(response, "usuario")

        response = self.get_by_id(content["id"])
        valid_response(response)
        user = valid_content(response, "usuario")

        assert bool(user["ativo"]) == True

        mock['password'] = hashlib.md5(mock['password']).hexdigest()
        self.valid_attr(mock, user)
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        loc_env = valid_content(response, "logical_environment")

        response = self.get_all()
        valid_response(response)
        content = valid_content(response, "logical_environment")

        for env in content:
            if env["id"] == loc_env["id"]:
                self.valid_attr(mock, env)
                break
Beispiel #17
0
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        content = valid_content(response, "filter")

        response = self.get_by_id(content["id"])
        valid_response(response)
        fil = valid_content(response, "filter")
        self.valid_attr(mock, fil)

        # Remove filter so it does not require cleaning db manually
        response = self.remove(content['id'])
        valid_response(response)
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        equipment_type = valid_content(response, "equipment_type")

        response = self.get_all()
        valid_response(response)
        content = valid_content(response, "equipment_type")

        for etype in content:
            if etype["id"] == equipment_type["id"]:
                self.valid_attr(mock, etype)
                break
Beispiel #19
0
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        groupl3 = valid_content(response, "group_l3")

        response = self.get_all()
        valid_response(response)
        content = valid_content(response, "group_l3")

        for grp in content:
            if grp["id"] == groupl3["id"]:
                self.valid_attr(mock, grp)
                break
Beispiel #20
0
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        model = valid_content(response, "model")

        response = self.get_all()
        valid_response(response)
        content = valid_content(response, "model")

        for mdl in content:
            if mdl["id"] == model["id"]:
                self.valid_attr(mock, mdl)
                break
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        interface = valid_content(response, self.XML_KEY)

        response = self.client_autenticado().get(
            self.URL_GET_BY_ID % interface['id'])
        valid_response(response)
        interface_from_db = valid_content(response, self.XML_KEY)
        if interface_from_db['protegida'] == 'False':
            interface_from_db['protegida'] = '0'
        elif interface_from_db['protegida'] == 'True':
            interface_from_db['protegida'] = '1'
        self.valid_attr(mock, interface_from_db)
 def test_get_by_equip_old_valid(self):
     response = self.client_autenticado().get(
         self.URL_GET_BY_EQUIP_OLD % self.EQUIP_VALID)
     valid_response(response)
     content = valid_content(response, self.XML_KEY)
     from_db = Interface.objects.filter(equipamento=self.EQUIP_VALID)
     assert len(content) == len(from_db)
 def test_get_by_equipment(self):
     response = self.client_autenticado().get(
         self.URL_GET_BY_EQUIP % self.ID_EQUIPMENT_VALID)
     valid_response(response)
     content = valid_content(response, self.XML_KEY, True)
     query = Q(equipamentoambiente__equipamento=self.ID_EQUIPMENT_VALID)
     valid_get_filtered(content, Ambiente, query)
 def test_get_by_env_vip_valid(self):
     response = self.get_by_env_vip(self.ID_ENV_VIP_VALID)
     valid_response(response)
     content = valid_content(response, self.XML_KEY)
     assert len(content) == len(
         self.OBJ.objects.select_related().filter(optionvipenvironmentvip__environment=self.ID_ENV_VIP_VALID)
     )
    def test_save_valid(self):
        mock = self.mock_valid()
        response = self.save({self.XML_KEY: mock})
        valid_response(response)
        content = valid_content(response, self.XML_KEY)

        tpa = TipoAcesso.get_by_pk(content["id"])
        self.valid_attr(mock, model_to_dict(tpa))
Beispiel #26
0
    def test_get_by_brand(self):
        response = self.client_autenticado().get(
            self.URL_GET_BRAND % self.ID_VALID)
        valid_response(response)
        content = valid_content(response, "model", True)

        query = Q(marca__id=self.ID_VALID)
        valid_get_filtered(content, Modelo, query)
Beispiel #27
0
 def test_save_unique(self):
     response = self.get_all()
     valid_response(response)
     content = valid_content(response, "model")
     model = content[0]
     mock = self.mock_valid()
     mock["name"] = model["nome"]
     self.process_save_attr_invalid(mock, CodeError.MODEL_DUPLICATE)
 def test_save_valid(self):
     mock = self.mock_valid()
     response = self.save({self.XML_KEY: mock})
     valid_response(response)
     equipment_type = valid_content(response, self.XML_KEY)
     from_db = EquipamentoAmbiente.objects.get(
         equipamento=self.ID_EQUIPMENT_VALID, ambiente=self.ID_ENVIRONMENT_VALID)
     assert str(from_db.id) == str(equipment_type['id'])
Beispiel #29
0
    def test_get_by_equipment(self):
        response = self.client_autenticado().get(
            self.URL_GET_EQUIPMENT % self.ID_VALID)
        valid_response(response)
        content = valid_content(response, "script", True)

        query = Q(equipamento__id=self.ID_VALID)
        valid_get_filtered(content, EquipamentoRoteiro, query)
 def test_get_vips_by_env_id_valid(self):
     response = self.client_autenticado().get(self.URL_GET_VIPS_FROM_ENV_VIP % self.ID_VALID_VIPS_ASSOCIATION)
     valid_response(response)
     content = valid_content(response)
     query = Q(ip__networkipv4__ambient_vip__id=self.ID_VALID_VIPS_ASSOCIATION) | Q(
         ipv6__networkipv6__ambient_vip__id=self.ID_VALID_VIPS_ASSOCIATION
     )
     valid_get_filtered(content, RequisicaoVips, query)