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