Beispiel #1
0
    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)
Beispiel #2
0
def test_get_nodes_3():
    assert len(dbaccess.get_nodes(21, 66, 1)) == 5
Beispiel #3
0
def test_get_nodes_2():
    assert len(dbaccess.get_nodes(21, 66)) == 80
Beispiel #4
0
def test_get_nodes_1():
    assert len(dbaccess.get_nodes(21)) == 1
    assert len(dbaccess.get_nodes(52)) == 0
Beispiel #5
0
def test_get_nodes_0():
    assert len(dbaccess.get_nodes()) == 8