def setUpClass(cls): global redis_graph cls.r = redis() cls.r.start() redis_con = cls.r.client() redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph)
def main(argv): global redis_con global redis_graph if "--debug" in argv: debug() else: with _redis() as redis_con: redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph) run_queries()
def debug(host, port): global redis_con global redis_graph redis_con = redis.Redis(host=host, port=port) redis_graph = Graph(redis_con, social_utils.graph_name) print("populate_graph") social_utils.populate_graph(redis_con, redis_graph) print("run_queries") run_queries()
def debug(): print("debug") global redis_con global redis_graph redis_con = redis.Redis(host='localhost', port=6379) redis_graph = Graph(social_utils.graph_name, redis_con) print("populate_graph") social_utils.populate_graph(redis_con, redis_graph) print("run_queries") run_queries()
def test_how_many_countries_each_friend_visited(self): with self.redis() as redis_con: redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph) actual_result = redis_graph.query(queries.how_many_countries_each_friend_visited_query.query) # assert result set self._assert_only_expected_resuls_are_in_actual_results( actual_result, queries.how_many_countries_each_friend_visited_query) # assert query run time self._assert_run_time(actual_result, queries.how_many_countries_each_friend_visited_query)
def test_friends_older_than_me(self): with self.redis() as redis_con: redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph) actual_result = redis_graph.query(queries.friends_older_than_me_query.query) # assert result set self._assert_only_expected_resuls_are_in_actual_results( actual_result, queries.friends_older_than_me_query) # assert query run time self._assert_run_time(actual_result, queries.friends_older_than_me_query)
def test_who_was_on_business_trip(self): with self.redis() as redis_con: redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph) actual_result = redis_graph.query(queries.who_was_on_business_trip_query.query) # assert result set self._assert_only_expected_resuls_are_in_actual_results( actual_result, queries.who_was_on_business_trip_query) # assert query run time self._assert_run_time(actual_result, queries.who_was_on_business_trip_query)
def setUpClass(cls): print "IndexScanFlowTest" global redis_graph cls.r = redis() cls.r.start() redis_con = cls.r.client() redis_graph = Graph(social_utils.graph_name, redis_con) # cls.r = redis.Redis() # redis_con = cls.r # redis_graph = Graph(social_utils.graph_name, cls.r) social_utils.populate_graph(redis_con, redis_graph) cls.build_indices()
def test_number_of_vacations_per_person(self): NUM_EXPECTED_RESULTS = 6 with self.redis() as redis_con: redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph) actual_result = redis_graph.query(queries.number_of_vacations_per_person_query.query) # assert result set self._assert_actual_results_contained_in_expected_results( actual_result, queries.number_of_vacations_per_person_query, NUM_EXPECTED_RESULTS) # assert query run time self._assert_run_time(actual_result, queries.number_of_vacations_per_person_query)
def main(argv): global redis_con global redis_graph parser = argparse.ArgumentParser(description='Social demo.', add_help=False) parser.add_argument('-h', '--host', dest='host', help='redis host') parser.add_argument('-p', '--port', dest='port', type=int, help='redis port') parser.add_argument("--debug", action='store_const', const=True) args = parser.parse_args() if args.debug is not None: debug('127.0.0.1', 6379) elif args.host is not None and args.port is not None: debug(args.host, args.port) else: with _redis() as redis_con: redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph) run_queries()
def setUp(self): global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph) self.build_indices()
def __init__(self): self.env = Env(decodeResponses=True) global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(redis_con, social_utils.graph_name) social_utils.populate_graph(redis_con, redis_graph)
def __init__(self): super(testSocialFlow, self).__init__() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph)
def __init__(self): self.env = Env() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph)