本文整理汇总了Python中networkapi.test.functions.valid_response函数的典型用法代码示例。如果您正苦于以下问题:Python valid_response函数的具体用法?Python valid_response怎么用?Python valid_response使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了valid_response函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_disconnect_no__write_permission
def test_disconnect_no__write_permission(self):
mock = self.mock_for_disconnect()
self.alter(self.ID_FOR_CONNECTION, {self.XML_KEY: mock})
response = self.client_no_write_permission().delete(
self.URL_REMOVE_CONNECTION % (self.ID_DISCONNECT_VALID, "0"))
valid_response(response, httplib.PAYMENT_REQUIRED)
示例2: test_save_ipv6_valid
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)
示例3: test_get_by_equip_old_valid
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)
示例4: test_alter_valid
def test_alter_valid(self):
mock = self.mock_network_alter_valid()
response = self.client_autenticado().postXML(
self.URL_ALTER, {self.XML_KEY_ALTER: mock})
valid_response(response)
net = NetworkIPv4.get_by_pk(self.ID_NETWORK_IPV4_ALTER_VALID)
self.valid_network_attr(mock, model_to_dict(net))
示例5: test_alter_valid
def test_alter_valid(self):
mock = self.mock_valid_alter()
response = self.client_autenticado().postXML(
self.URL_ALTER, {self.XML_KEY: mock})
valid_response(response)
tpa = EquipamentoAcesso.get_by_pk(self.ID_ALTER_VALID)
self.valid_attr(mock, model_to_dict(tpa))
示例6: test_save_ipv4_valid
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)
示例7: test_save_none
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)
示例8: test_alter_valid
def test_alter_valid(self):
mock = self.mock_valid_alter()
response = self.alter(self.ID_ALTER_VALID, {self.XML_KEY: mock})
valid_response(response)
nt = TipoRede.get_by_pk(self.ID_ALTER_VALID)
self.valid_attr(mock, model_to_dict(nt))
示例9: test_authenticate_wrong_password
def test_authenticate_wrong_password(self):
mock = self.user_login_valid()
mock['password'] = string_generator(10)
response = self.client_autenticado().postXML(
self.URL_AUTHENTICATE, {self.XML_KEY: mock})
valid_response(response)
assert xml2dict(response.content) == None
示例10: test_get_by_equipment_no_read_permission
def test_get_by_equipment_no_read_permission(self):
equip_access_map = dict()
equip_access_map['name'] = self.EQUIPMENT_NAME_VALID
response = self.client_no_read_permission().postXML(
self.URL_GET_BY_EQUIP_NAME, {self.XML_KEY: equip_access_map})
valid_response(response, httplib.PAYMENT_REQUIRED)
示例11: test_get_by_equipment
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)
示例12: test_get_by_env_vip_valid
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)
)
示例13: test_change_pass_maxsize
def test_change_pass_maxsize(self):
data = self.user_change_pass_valid()
data['password'] = string_generator(46)
response = self.client_autenticado().postXML(
self.URL_CHANGE_PASS, {self.XML_KEY: data})
valid_response(response, status_code=httplib.INTERNAL_SERVER_ERROR)
self._attr_invalid(response)
示例14: test_authenticate_none_password
def test_authenticate_none_password(self):
mock = self.user_login_valid()
mock['password'] = None
response = self.client_autenticado().postXML(
self.URL_AUTHENTICATE, {self.XML_KEY: mock})
valid_response(response, status_code=httplib.INTERNAL_SERVER_ERROR)
self._attr_invalid(response)
示例15: test_authenticate_empty_username
def test_authenticate_empty_username(self):
mock = self.user_login_valid()
mock['username'] = ''
response = self.client_autenticado().postXML(
self.URL_AUTHENTICATE, {self.XML_KEY: mock})
valid_response(response, status_code=httplib.INTERNAL_SERVER_ERROR)
self._attr_invalid(response)