def test_get_all(self): expected = ['192.168.1.101','192.168.1.102','192.168.1.103',\ '192.168.1.111','192.168.1.112','192.168.1.113',\ '192.168.1.121','192.168.1.122','192.168.1.100'] self.create_test_ip_data() ips = IP.get_all(db.session.query) actual = [r.ip for r in ips] self.assertListEqual(sorted(expected), sorted(actual))
def all_ip(): result = [] ips = IP.get_all(db.session.query) for ip in ips: result.append(dict(ip=ip.ip, is_used=ip.is_used)) return jsonify(result=result)
def list_ip(): fmt = request.args.get("format") ips = IP.get_all(db.session.query) result = [r.ip for r in ips] return formatter(fmt, result)