コード例 #1
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
    def test_handler_decorators(self):
        driver = boatd.load_driver(self.mock_config)

        @driver.handler('test_handler_decorators')
        def test():
            return 'test passed'

        func = driver.handlers.get('test_handler_decorators')
        assert func() == 'test passed'
コード例 #2
0
ファイル: test_boatd.py プロジェクト: zuzak/boatd
 def test_load_driver(self):
     configuration = {
         'driver': {
             'file': 'driver.py'
         }
     }
     mock_config = boatd.Config(configuration)
     mock_config.filename = os.path.join(self.directory, 'c.yaml')
     driver = boatd.load_driver(mock_config)
     assert driver.heading() == 2.43
コード例 #3
0
ファイル: test_boatd.py プロジェクト: SamStudio8/boatd
 def test_load_driver(self):
     configuration = {
         'scripts': {
             'driver': 'driver.py'
         }
     }
     mock_config = boatd.Config(configuration)
     mock_config.filename = os.path.join(self.directory, 'c.yaml')
     driver = boatd.load_driver(mock_config)
     assert driver.handlers.get('pony')() == 'magic'
コード例 #4
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
 def test_bad_driver(self):
     self.mock_config.scripts.driver = os.path.join(self.directory,
                                                    'bad_driver.py')
     try:
         driver = boatd.load_driver(self.mock_config)
     except SyntaxError:
         pass
     except Exception as e:
         assert False, 'An exception other than SyntaxError was raised: {}'.format(e)
     else:
         assert False, 'No exception was raised'
コード例 #5
0
 def test_bad_driver(self):
     self.mock_config.driver.file = os.path.join(self.directory,
                                                 'bad_driver.py')
     try:
         driver = boatd.load_driver(self.mock_config)
     except SyntaxError:
         pass
     except Exception as e:
         assert False, 'An exception other than SyntaxError was raised: {}'.format(
             e)
     else:
         assert False, 'No exception was raised'
コード例 #6
0
 def test_heading(self):
     driver = boatd.load_driver(self.mock_config)
     heading = driver.heading
     assert heading() == 2.43
コード例 #7
0
 def test_loading_driver(self):
     assert boatd.load_driver(self.mock_config)
コード例 #8
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
 def test_set_rudder_multiple(self):
     driver = boatd.load_driver(self.mock_config)
     rudder = driver.handlers.get('rudder')
     rudder(20)
     rudder(-10)
     assert driver.some_hardware.get('rudder') == -10
コード例 #9
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
 def test_empty_hardware(self):
     driver = boatd.load_driver(self.mock_config)
     assert len(driver.some_hardware) == 0
コード例 #10
0
ファイル: test_driver.py プロジェクト: boatd/boatd
 def test_wind_speed(self):
     driver = boatd.load_driver(self.mock_config)
     heading = driver.wind_speed
     assert heading() == 25
コード例 #11
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
 def test_heading(self):
     driver = boatd.load_driver(self.mock_config)
     heading = driver.handlers.get('heading')
     assert heading() == 2.43
コード例 #12
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
 def test_pony_runs(self):
     driver = boatd.load_driver(self.mock_config)
     pony = driver.handlers.get('pony')
     assert pony() == 'magic'
コード例 #13
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
 def test_pony_exists(self):
     driver = boatd.load_driver(self.mock_config)
     assert driver.handlers.get('pony')
コード例 #14
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
 def test_loading_driver(self):
     assert boatd.load_driver(self.mock_config)
コード例 #15
0
ファイル: test_boatd.py プロジェクト: thip/boatd
 def test_load_driver(self):
     configuration = {'driver': {'file': 'driver.py'}}
     mock_config = boatd.Config(configuration)
     mock_config.filename = os.path.join(self.directory, 'c.yaml')
     driver = boatd.load_driver(mock_config)
     assert driver.heading() == 2.43
コード例 #16
0
 def test_wind_speed(self):
     driver = boatd.load_driver(self.mock_config)
     heading = driver.wind_speed
     assert heading() == 25
コード例 #17
0
 def test_empty_hardware(self):
     driver = boatd.load_driver(self.mock_config)
     assert len(driver.some_hardware) == 0
コード例 #18
0
ファイル: test_driver.py プロジェクト: Qinusty/boatd
 def test_wind_speed(self):
     driver = boatd.load_driver(self.mock_config)
     heading = driver.handlers.get('wind_speed')
     assert heading() == 25
コード例 #19
0
ファイル: test_boatd.py プロジェクト: Qinusty/boatd
 def test_load_driver(self):
     configuration = {"scripts": {"driver": "driver.py"}}
     mock_config = boatd.Config(configuration)
     mock_config.filename = os.path.join(self.directory, "c.yaml")
     driver = boatd.load_driver(mock_config)
     assert driver.handlers.get("pony")() == "magic"
コード例 #20
0
ファイル: test_driver.py プロジェクト: boatd/boatd
 def test_heading(self):
     driver = boatd.load_driver(self.mock_config)
     heading = driver.heading
     assert heading() == 2.43