def test_create_redirect_action(): name = "0" action = Action(name, actions['redirect']) data = action.data assert action.name == "0" assert not action.partition assert data.get('request') assert not data.get('forward') assert not data.get('pool') assert data.get('redirect') assert data.get('location') == "http://boulder-dev.f5.com" assert not data.get('reset')
def test_create_pool_forwarding_action(): name = "0" action = Action(name, actions['pool_forward']) data = action.data assert action.name == "0" assert not action.partition assert data.get('request') assert data.get('forward') assert data.get('pool') == "/Test/my_pool" assert not data.get('redirect') assert not data.get('location') assert not data.get('reset')
def test_equal_actions(): name = "0" action_redirect_1 = Action(name, actions['redirect']) action_redirect_2 = Action(name, actions['redirect']) assert id(action_redirect_1) != id(action_redirect_2) assert action_redirect_1 == action_redirect_2 action_redirect_1.data['location'] = "http://sea-dev.f5.com" assert not action_redirect_1 == action_redirect_2 assert action_redirect_1 != action_redirect_2 fake_action = { "request": False, "forward": False, "pool": None, "location": None, "reset": False, "redirect": False } assert action_redirect_1 != fake_action assert action_redirect_1 != actions['redirect']
def test_create_set_variable_action(): name = "0" action = Action(name, actions['setVariable']) data = action.data assert action.name == "0" assert not action.partition assert data.get('request') assert data.get('expression') assert data.get('tmName') assert data.get('tcl') assert data.get('setVariable') assert not data.get('pool') assert not data.get('redirect') assert not data.get('location') assert not data.get('reset') assert not data.get('forward')
def test_create_rewrite_host_action(): name = "0" action = Action(name, actions['rewrite_host']) data = action.data assert action.name == "0" assert not action.partition assert data.get('httpHost') assert data.get('request') assert data.get('replace') assert data.get('value') == 'bar.com' assert not data.get('httpUri') assert not data.get('path') assert not data.get('forward') assert not data.get('reset') assert not data.get('pool') assert not data.get('redirect') assert not data.get('location')
def test_uri_path(bigip): name = "0" action = Action(name, actions['redirect']) with pytest.raises(NotImplementedError): action._uri_path(bigip)
def test_str_action(): name = "0" action = Action(name, actions['redirect']) assert str(action)
def test_create_vs_forward_action(): name = "0" with pytest.raises(ValueError): action = Action(name, actions['virtual_forward'])
def test_create_invalid_action(): name = "0" with pytest.raises(ValueError): action = Action(name, actions['invalid_action'])