#!/usr/bin/env python

PKG = 'lg_sv'
NAME = 'test_sv_server'
LAT = '43.726319'
LON = '12.636377'

import sys
import rospy
import rostest
import unittest
from lg_sv import StreetviewUtils

class TestSVServer(unittest.TestCase):
    def setUp(self):
        pass
    
    def tearDown(self):
        pass

    def test_sv_utils(self):
        response = StreetviewUtils.get_panoid_from_lat_lon(LAT, LON)
        self.assertIsInstance(response, str)


if __name__ == '__main__':
    rostest.rosrun(PKG, NAME, TestSVServer, sys.argv)

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

@@ -91,16 +91,84 @@
 36377'%0A%0A
+TILT_MAX = 80%0ATILT_MIN = -80%0ANAV_SENSITIVITY = 1%0ANAV_INTERVAL = .1%0A%0A
 import s
@@ -251,267 +251,1461 @@
 tils
-%0A%0Aclass TestSVServer(unittest.TestCase):%0A    def setUp(self):%0A        pass%0A    %0A    def tearDown(self):%0A        pass%0A%0A    def test_sv_utils(self):%0A        response = StreetviewUtils.get_panoid_from_lat_lon(LAT, LON)%0A        self.assertIsInstance(response, str
+, StreetviewServer%0A%0Aclass MockPublisher:%0A    def __init__(self):%0A        self.data = %5B%5D%0A%0A    def publish(self, data):%0A        self.data.append(data)%0A%0Aclass TestSVServer(unittest.TestCase):%0A    def setUp(self):%0A        self.location_pub = MockPublisher()%0A        self.pano_pub = MockPublisher()%0A        self.pov_pub = MockPublisher()%0A        self.server = StreetviewServer(%0A             self.location_pub, self.pano_pub, self.pov_pub, TILT_MAX,%0A             TILT_MIN, NAV_SENSITIVITY, NAV_INTERVAL)%0A    %0A    def tearDown(self):%0A        pass%0A%0A    def test_sv_utils(self):%0A        response = StreetviewUtils.get_panoid_from_lat_lon(LAT, LON)%0A        self.assertIsInstance(response, str)%0A%0A    def test_1_pano_pub(self):%0A        # test initial state%0A        self.assertEqual(len(self.pano_pub.data), 0,%0A                         'pano_pub data should not have anything in it')%0A        self.assertEqual(self.server.panoid, str(),%0A                         'panoid should not be set yet')%0A        new_pano = 'foo_bar'%0A        self.server.pub_panoid(new_pano)%0A        # test final state%0A        self.assertEqual(len(self.pano_pub.data), 1,%0A                         'pano_pub data did not have the correct amount of data')%0A        self.assertEqual(self.server.panoid, new_pano,%0A                         'panoid should not be set yet')%0A        self.assertEqual(self.pano_pub.data%5B0%5D, new_pano,%0A                         'pano_pub data did not have the correct value'
 )%0A%0A%0A

test for panoid publisher