def get_children(self, get_data): addresses = [] address_str = get_data.get('address', None) if address_str is not None: addresses = address_str.split(",") print "address_str is ", address_str print "addresses is ", addresses # should return JSON compatible data...for javascript on the other end. # result = dbaccess.connections() result = {} if not addresses: result["_"] = list(dbaccess.get_nodes()) else: for address in addresses: result[address] = list(dbaccess.get_nodes(*map(int, address.split(".")))) return json.dumps(result, default=decimal_default)
def test_get_nodes_3(): assert len(dbaccess.get_nodes(21, 66, 1)) == 5
def test_get_nodes_2(): assert len(dbaccess.get_nodes(21, 66)) == 80
def test_get_nodes_1(): assert len(dbaccess.get_nodes(21)) == 1 assert len(dbaccess.get_nodes(52)) == 0
def test_get_nodes_0(): assert len(dbaccess.get_nodes()) == 8