class TestHardwareCommands():
    def setup_method(self):
        self.hardware = DummyHardwareAdapter(['a', 'b', 'c'])
        settings.hardware = self.hardware
        from diffcalc import hardware
        reload(hardware)
        self.commands = hardware

    def testSetcut(self):
        print "*******"
        self.commands.setcut()
        print "*******"
        self.commands.setcut('a')
        print "*******"
        self.commands.setcut('a', -181)
        print "*******"
        eq_(self.hardware.get_cuts()['a'], -181)
        assert_raises(ValueError, self.commands.setcut, 'a', 'not a number')
        assert_raises(KeyError, self.commands.setcut, 'not an axis', 1)

    def test_set_lim(self):
        self.commands.setmin('a', -1)
        print "*******"
        self.commands.setmin()
        print "*******"
        self.commands.setmax()
        print "*******"