def test_create_config(self,stream,dump,mkpath): conf=config.create_config() assert conf.history_file==os.path.join(config.config_folder(),config.HISTORY_FILE) assert conf.rss_url==config.URL_NOT_SET assert conf.download_dir==os.path.join(config.config_folder(),config.TORRENTS_DIR) mkpath.assert_called_once() dump.assert_called_once()
def test_create_config_yaml(self,stream): mock.mock_open(stream); w=StringIO.StringIO() stream().write.side_effect= lambda t: w.write(t) config.create_config() cnf=yaml.load(w.getvalue()) assert cnf.history_file==os.path.join(config.config_folder(),config.HISTORY_FILE) assert cnf.rss_url==config.URL_NOT_SET assert cnf.download_dir==os.path.join(config.config_folder(),config.TORRENTS_DIR)
def test_check_config_file(self): #check that the config_file returns the appropriate value assert config.config_file()==os.path.join(config.config_folder(),"cnf.yml")
def test_check_config_folder(self,home): #check that the config_folder returns the appropriate value home.return_value="/home/user" assert config.config_folder()=="/home/user/%s"%config.CONFIG_FOLDER