コード例 #1
0
ファイル: test_importer.py プロジェクト: matt-bernhardt/trapp
def test_importer_reportStatus(excel):
    log = Log('test.log')
    importer = Importer(excel, log)
    # Still working out how best to test this method - all it does is write
    # content out to log files, no calculation
    assert importer.reportStatus() is True
    importer.missing = ['Missing Record']
    assert importer.reportStatus() is True
コード例 #2
0
ファイル: test_importer.py プロジェクト: matt-bernhardt/trapp
def test_importer_checkFields(excel):
    log = Log('test.log')
    importer = Importer(excel, log)
    requiredFields = (['foo', 'bar'])
    assert importer.checkFields(requiredFields) is True
    with pytest.raises(RuntimeError) as excinfo:
        requiredFields = (['foo', 'none'])
        importer.checkFields(requiredFields)
    assert 'missing the following columns' in str(excinfo.value)
コード例 #3
0
ファイル: test_importer.py プロジェクト: matt-bernhardt/trapp
def test_importer_processMissingRecords(excel):
    log = Log('test.log')
    importer = Importer(excel, log)
    assert len(importer.missing) == 0
    assert importer.skipped == 0
    importer.processMissingRecord('Missing Record', 0)
    assert len(importer.missing) == 1
    assert importer.skipped == 1
    importer.processMissingRecord('Another Missing Record', 0)
    assert len(importer.missing) == 2
    assert importer.skipped == 2
    importer.processMissingRecord('Missing Record', 0)
    assert len(importer.missing) == 2
    assert importer.skipped == 3
コード例 #4
0
ファイル: test_importer.py プロジェクト: matt-bernhardt/trapp
def test_importer_lookupTeamID(excel):
    log = Log('test.log')
    importer = Importer(excel, log)
    needle = 'Columbus Crew'
    assert importer.lookupTeamID(needle) == 1
    with pytest.raises(RuntimeError) as excinfo:
        needle = 'Columbus Magic'
        importer.lookupTeamID(needle)
    assert 'Team not found: ' in str(excinfo.value)
    with pytest.raises(RuntimeError) as excinfo:
        needle = 'Duplicate Sample Team'
        importer.lookupTeamID(needle)
    assert 'Ambiguous team name: ' in str(excinfo.value)
コード例 #5
0
ファイル: test_importer.py プロジェクト: matt-bernhardt/trapp
def test_importer_generic_importRecord(excel):
    log = Log('test.log')
    importer = Importer(excel, log)
    dummyRecord = 'Dummy Record'
    assert importer.importRecord(dummyRecord) is True
コード例 #6
0
ファイル: test_importer.py プロジェクト: matt-bernhardt/trapp
def test_importer_setLog(excel):
    log = Log('test.log')
    log2 = Log('test2.log')
    importer = Importer(excel, log)
    importer.setLog(log2)
    assert importer.log.name == 'test2.log'
コード例 #7
0
ファイル: test_importer.py プロジェクト: matt-bernhardt/trapp
def test_importer_correctValues(excel):
    log = Log('test.log')
    importer = Importer(excel, log)
    assert importer.correctValues() is True