Esempio n. 1
0
def test_generate_title():
    timestamp1 = 1212143496
    timestamp2 = timestamp1 + 5000
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (1.4 hours)'

    timestamp2 = timestamp1 + 10
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (10 seconds)'

    timestamp2 = timestamp1 + 60 * 2
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (2.0 minutes)'

    timestamp2 = timestamp1 + 60 * 2 + 30
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (2.5 minutes)'

    timestamp2 = timestamp1 + 3600 * 26
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (1.1 days)', result
def test_generate_title():
    timestamp1 = 1212143496
    timestamp2 = timestamp1 + 5000
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (1.4 hours)'
    
    timestamp2 = timestamp1 + 10
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (10 seconds)'
    
    timestamp2 = timestamp1 + 60 * 2
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (2.0 minutes)'
    
    timestamp2 = timestamp1 + 60 * 2 + 30
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (2.5 minutes)'
    
    timestamp2 = timestamp1 + 3600 * 26
    result = _generate_title(timestamp1, timestamp2)
    assert result == '2008/05/30 11:31:36 (1.1 days)', result
Esempio n. 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"