Ignore:
Timestamp:
Apr 11, 2020, 4:46:15 PM (7 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
3db3d13
Parents:
da2be70
Message:
  • Added yapf style config (src/python-style.yapf)
    • Updated all files to the yapf formatted version
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mapservice/tests/test_config.py

    rda2be70 r7be94aa  
    2323from gnuboat_mapservice.server_impl import Config
    2424
     25
    2526class TestConfig(unittest.TestCase):
    26         def test_config_from_file(self):
    27                 """Test case load config from file
     27    def test_config_from_file(self):
     28        """Test case load config from file
    2829                """
    29                 new_config = {
    30                         'TESTING': True,
    31                         'DOES_NOT_EXISTS': 1234
    32                 }
    33                
    34                 config = Config.Config()
    35                 assert config.TESTING == False
    36                
    37                 config_file = tempfile.NamedTemporaryFile(mode='w', prefix='gnuboat-test-config', delete=False)
    38                 yaml.dump(new_config, config_file, default_flow_style=False, allow_unicode=True)
    39                 config_file.close()
    40                 config_file = os.path.join(tempfile.gettempdir(), config_file.name)
     30        new_config = {'TESTING': True, 'DOES_NOT_EXISTS': 1234}
    4131
    42                 config = Config.load_from_file(config_file)
    43                 assert config.TESTING == True
    44                 assert config.DOES_NOT_EXISTS == 1234
    45                 os.remove(config_file)
     32        config = Config.Config()
     33        assert config.TESTING == False
     34
     35        config_file = tempfile.NamedTemporaryFile(
     36            mode='w', prefix='gnuboat-test-config', delete=False
     37        )
     38        yaml.dump(
     39            new_config,
     40            config_file,
     41            default_flow_style=False,
     42            allow_unicode=True
     43        )
     44        config_file.close()
     45        config_file = os.path.join(tempfile.gettempdir(), config_file.name)
     46
     47        config = Config.load_from_file(config_file)
     48        assert config.TESTING == True
     49        assert config.DOES_NOT_EXISTS == 1234
     50        os.remove(config_file)
     51
    4652
    4753if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.