Beispiel #1
0
def test_title2foldername():
    title = '2008/05/30 11:31:36 (1.4 hours)'
    result = _title2foldername(title)
    assert result == '2008-05-30_11.31.36__1.4_hours', result

    title = '2008/05/30 11:31:36 (10 seconds)'
    result = _title2foldername(title)
    assert result == '2008-05-30_11.31.36__10_seconds', result

    title = '2008/05/30 11:31:36 (2.0 minutes)'
    result = _title2foldername(title)
    assert result == '2008-05-30_11.31.36__2.0_minutes', result
def test_title2foldername():
    title = '2008/05/30 11:31:36 (1.4 hours)'
    result = _title2foldername(title)
    assert result == '2008-05-30_11.31.36__1.4_hours', result
    
    title = '2008/05/30 11:31:36 (10 seconds)'
    result = _title2foldername(title)
    assert result == '2008-05-30_11.31.36__10_seconds', result
    
    title = '2008/05/30 11:31:36 (2.0 minutes)'
    result = _title2foldername(title)
    assert result == '2008-05-30_11.31.36__2.0_minutes', result
Beispiel #3
0
def test_generate():
    generate('fake.marshal')
    # this should have created a directory called '2008-05-30_11.31.36__9_seconds'
    # because the _before_generate() starts on 1212143496 and does a loop for 11
    # revs which would mean the test lasts for 10 seconds.
    expect_title = _generate_title(1212143496, 1212143496 + 10)
    #print expect_title

    expect_foldername = _title2foldername(expect_title)

    assert expect_foldername in os.listdir(
        '.'), "didn't create folder %r" % expect_foldername

    assert os.path.isfile(os.path.join(expect_foldername, 'index.html'))
    report = open(os.path.join(expect_foldername, 'index.html')).read()

    assert expect_title in report, "couldn't find expected title"
def test_generate():
    generate('fake.marshal')
    # this should have created a directory called '2008-05-30_11.31.36__9_seconds'
    # because the _before_generate() starts on 1212143496 and does a loop for 11
    # revs which would mean the test lasts for 10 seconds.
    expect_title = _generate_title(1212143496, 1212143496+ 10)
    #print expect_title
    
    expect_foldername = _title2foldername(expect_title)
    
    assert expect_foldername in os.listdir('.'), "didn't create folder %r"% expect_foldername
    
    assert os.path.isfile(os.path.join(expect_foldername, 'index.html'))
    report = open(os.path.join(expect_foldername, 'index.html')).read()
    
    assert expect_title in report, "couldn't find expected title"