| #!/usr/bin/python2 |
| # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| # |
| # Copyright (C) 2014 University of Arizona |
| # Author: Yi Huang <ltr120@email.arizona.edu> |
| # See COPYING for copyright and distribution information. |
| # |
| |
| import os |
| import unittest |
| import subprocess |
| |
| class test_localhop(unittest.TestCase): |
| """Test case for testing /localhop""" |
| |
| def setUp(self): |
| print "\nTesting /localhop" |
| print "*****************" |
| os.chdir("test_localhop") |
| |
| def tearDown(self): |
| print "*****************" |
| os.chdir("..") |
| |
| def test_localhost_scope(self): |
| ret = subprocess.call(["./localhop-test.sh"], shell=True) |
| print "Test script return value:", ret |
| errormsg = { |
| 1 : "Invalid command line arguments", |
| 2 : "Fail to add nexthop of ndn:/localhop", |
| 3 : "Interest with name ndn:/localhop/test-localhop/A/1 was received on host C", |
| 4 : "ndn:/localhop/test-localhop/A/1 is answered.", |
| 5 : "ndn:/localhop/test-localhop/B/1 is not correctly answered.", |
| } |
| if (ret != 0): |
| self.fail(errormsg[ret]) |