diff --git a/Makefile b/Makefile index 916960f..be1e747 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,8 @@ groundstation/proto/gizmo_pb2.py: groundstation/proto/gizmo.proto clean: find ./ -iname "*.pyc" -delete + +_test: + +test: _test + python -m unittest discover test diff --git a/test/station_fixture.py b/test/station_fixture.py new file mode 100644 index 0000000..f39ad81 --- /dev/null +++ b/test/station_fixture.py @@ -0,0 +1,14 @@ +import tempfile +import shutil +import unittest + +from groundstation.node import Node +from groundstation.station import Station + +class StationTestCase(unittest.TestCase): + def setUp(self): + self.node = Node() + self.station = Station(tempfile.mkdtemp(), self.node) + + def tearDown(self): + shutil.rmtree(self.station.repo.path) diff --git a/test/test_station.py b/test/test_station.py new file mode 100644 index 0000000..79df80f --- /dev/null +++ b/test/test_station.py @@ -0,0 +1,9 @@ +from station_fixture import StationTestCase + +class TestStationObjectCache(StationTestCase): + """Proves that querying for an unknown object returns false, then true""" + def test_recently_queried(self): + self.assertFalse(self.station.recently_queried("rawrtest")) + self.assertTrue(self.station.recently_queried("rawrtest")) + self.assertFalse(self.station.recently_queried("rawrtestSomeOther")) +