def test_argparse_shp_path_string_fail():
    """
    Test shapefile path input
    """
    
    section = 'software'
    arg = r'test_data\boundary_ncr.shp.fail'
    arg_type = 'shp_path'
    
    kwargs = dict()
    kwargs['arg'] = arg
    kwargs['section'] = section
    kwargs['arg_type'] = arg_type
    kwargs['config_path'] = TEST_CONFIG_PATH
    _ = argparse_config(**kwargs)
    
    # Assert config file is modified
    config = ConfigParser()
    config.read(TEST_CONFIG_PATH)
    actual = config.get(section, arg_type)
    expected = arg
    message = 'shp_path not updated in config file'
    assert actual == expected, message
def test_argparse_tweepy_access_secret():
    """
    Test Tweepy access token
    """
    
    section = 'tweepy'
    arg = 'TestAccessSecret4567'
    arg_type = 'access_secret'
    
    kwargs = dict()
    kwargs['arg'] = arg
    kwargs['section'] = section
    kwargs['arg_type'] = arg_type
    kwargs['config_path'] = TEST_CONFIG_PATH
    _ = argparse_config(**kwargs)
    
    # Assert config file is modified
    config = ConfigParser()
    config.read(TEST_CONFIG_PATH)
    actual = config.get(section, arg_type)
    expected = arg
    message = 'Tweepy access secret not updated in config file'
    assert actual == expected, message
def test_argparse_loc_database_path_string():
    """
    Test location database input
    """
    
    section = 'software'
    arg = r'test_data\locations.sqlite'
    arg_type = 'locations_path'
    
    kwargs = dict()
    kwargs['arg'] = arg
    kwargs['section'] = section
    kwargs['arg_type'] = arg_type
    kwargs['config_path'] = TEST_CONFIG_PATH
    _ = argparse_config(**kwargs)
    
    # Assert config file is modified
    config = ConfigParser()
    config.read(TEST_CONFIG_PATH)
    actual = config.get(section, arg_type)
    expected = arg
    message = 'locations_path not updated in config file'
    assert actual == expected, message
def test_argparse_tweepy_consumer_key():
    """
    Test Tweepy consumer key
    """
    
    section = 'tweepy'
    arg = 'TestConsumerKey1234'
    arg_type = 'consumer_key'
    
    kwargs = dict()
    kwargs['arg'] = arg
    kwargs['section'] = section
    kwargs['arg_type'] = arg_type
    kwargs['config_path'] = TEST_CONFIG_PATH
    _ = argparse_config(**kwargs)
    
    # Assert config file is modified
    config = ConfigParser()
    config.read(TEST_CONFIG_PATH)
    actual = config.get(section, arg_type)
    expected = arg
    message = 'Tweepy consumer token not updated in config file'
    assert actual == expected, message