Yi Huang | 401f796 | 2014-04-20 11:13:36 -0700 | [diff] [blame] | 1 | #!/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 | |
| 9 | import os |
| 10 | import unittest |
| 11 | import subprocess |
| 12 | |
| 13 | class 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 | |
Eric Newberry | f28295a | 2015-07-04 17:51:19 -0700 | [diff] [blame] | 25 | def test_localhop(self): |
Yi Huang | 401f796 | 2014-04-20 11:13:36 -0700 | [diff] [blame] | 26 | ret = subprocess.call(["./localhop-test.sh"], shell=True) |
| 27 | print "Test script return value:", ret |
| 28 | errormsg = { |
| 29 | 1 : "Invalid command line arguments", |
Eric Newberry | f3248ea | 2016-08-07 11:48:50 -0700 | [diff] [blame^] | 30 | 2 : "Failed to add nexthop of ndn:/localhop", |
| 31 | 3 : "Interest with name ndn:/localhop/test-localhop/1 was received on host C", |
| 32 | 4 : "Interest ndn:/localhop/test-localhop/1 answered with a Data.", |
Yi Huang | 401f796 | 2014-04-20 11:13:36 -0700 | [diff] [blame] | 33 | } |
| 34 | if (ret != 0): |
| 35 | self.fail(errormsg[ret]) |