blob: f4d56f5f079bf27b3d3a44222c86a806b3322cab [file] [log] [blame]
Yi Huang401f7962014-04-20 11:13:36 -07001#!/usr/bin/python2
2# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
3#
4# Copyright (C) 2014 University of Arizona
5# Author: Yi Huang <ltr120@email.arizona.edu>
6# See COPYING for copyright and distribution information.
7#
8
9import os
10import unittest
11import subprocess
12
13class test_localhop(unittest.TestCase):
14 """Test case for testing /localhop"""
15
16 def setUp(self):
17 print "\nTesting /localhop"
18 print "*****************"
19 os.chdir("test_localhop")
20
21 def tearDown(self):
22 print "*****************"
23 os.chdir("..")
24
25 def test_localhost_scope(self):
26 ret = subprocess.call(["./localhop-test.sh"], shell=True)
27 print "Test script return value:", ret
28 errormsg = {
29 1 : "Invalid command line arguments",
30 2 : "Fail to add nexthop of ndn:/localhop",
31 3 : "Interest with name ndn:/localhop/test-localhop/A/1 was received on host C",
32 4 : "ndn:/localhop/test-localhop/A/1 is answered.",
33 5 : "ndn:/localhop/test-localhop/B/1 is not correctly answered.",
34 }
35 if (ret != 0):
36 self.fail(errormsg[ret])