コード例 #1
0
def test_no_matching_links():
    """ test_get_newest_exception_raise_when_no_matching_links """
    links = ['/test/dir-with']
    base_url = '/test'
    pattern = 'dir-with-%Y-weird-%m-date-%d/dump'
    with pytest.raises(RuntimeError):
        srmdumps.get_newest(base_url, pattern, links)
コード例 #2
0
def test_be_on_directory():
    """ test_get_newest_pattern_can_be_on_directory """
    links = ['/test/dir-with-2015-weird-01-date-30']
    base_url = '/test'
    pattern = 'dir-with-%Y-weird-%m-date-%d/dump'
    newest, date = srmdumps.get_newest(base_url, pattern, links)
    eq_(newest, links[0] + '/dump')
    eq_(date, datetime(2015, 1, 30))
コード例 #3
0
def test_patterns_on_file_names():
    """ test_get_newest_matches_the_patterns_on_file_names """
    links = ['/test/filename-with-2015-weird-01-date-30']
    base_url = '/test'
    pattern = 'filename-with-%Y-weird-%m-date-%d'
    newest, date = srmdumps.get_newest(base_url, pattern, links)
    eq_(newest, links[0])
    eq_(date, datetime(2015, 1, 30))
コード例 #4
0
def test_the_newest_path():
    """ test_get_newest_returns_actually_the_newest_path """
    links = [
        '/test/filename-with-2014-weird-01-date-10',
        '/test/filename-with-2015-weird-01-date-30',
        '/test/filename-with-2015-weird-01-date-10',
    ]
    base_url = '/test'
    pattern = 'filename-with-%Y-weird-%m-date-%d'
    newest, date = srmdumps.get_newest(base_url, pattern, links)
    eq_(newest, '/test/filename-with-2015-weird-01-date-30')
    eq_(date, datetime(2015, 1, 30))