def FakePool(): fake_ltm_instance = mock.MagicMock() fake_ltm_instance.bigip.icr_uri = 'https://0.0.0.0/mgmt/tm/' fake_pool = Pool(fake_ltm_instance) fake_pool._del_arp_and_fdb = mock.MagicMock() fake_pool._get_items = mock.MagicMock() return fake_pool
def itest_get_load_balancing(): response = BigIPMock.create_mock_response( 200, BigIPMock.read_json_file(JSON_FILE)) big_ip = BigIPMock(response) test_pool = Pool(big_ip) mode = test_pool.get_lb_method("my-Pool") assert mode == "ROUND_ROBIN"
def itest_get_description(): response = BigIPMock.create_mock_response( 200, BigIPMock.read_json_file(JSON_FILE)) big_ip = BigIPMock(response) test_pool = Pool(big_ip) description = test_pool.get_description("my-Pool") assert description == "sdfds"
def itest_get_description_error(): response = BigIPMock.create_mock_response( 500, BigIPMock.read_json_file(JSON_FILE)) big_ip = BigIPMock(response) test_pool = Pool(big_ip) # should raise a PoolQueryException with pytest.raises(exceptions.PoolQueryException): test_pool.get_description("my-Pool")