Exemple #1
0
def assert_non_existing(monkeypatch,
                        fixture,
                        has_null_source=True,
                        has_details=True):
    monkeypatch.setattr(Config(), 'new_file', True)
    assert Config().new_file, "didnt get patched"

    difference = fixture.compare(MissingFile('/nonexisting', fixture))

    assert difference.source2 == '/nonexisting'
    assert not has_details or len(difference.details) > 0
    assert not has_null_source or difference.details[-1].source2 == '/dev/null'
Exemple #2
0
def test_compare_non_existing(monkeypatch, gzip1):
    monkeypatch.setattr(Config(), 'new_file', True)
    difference = gzip1.compare(MissingFile('/nonexisting', gzip1))
    assert difference.source2 == '/nonexisting'
    assert difference.details[-1].source2 == '/dev/null'
Exemple #3
0
def test_compare_non_existing(monkeypatch, exe1):
    monkeypatch.setattr(Config(), 'new_file', True)
    difference = exe1.compare(MissingFile('/nonexisting', exe1))
    assert difference.source2 == '/nonexisting'
    assert len(difference.details) > 0
Exemple #4
0
def test_compare_non_existing_with_xxd(binary1):
    difference = binary1.compare_bytes(MissingFile('/nonexisting', binary1))
    assert difference.source2 == '/nonexisting'
Exemple #5
0
def test_compare_two_nonexisting_files():
    file1 = MissingFile('/nonexisting1')
    file2 = MissingFile('/nonexisting2')
    difference = file1.compare(file2)
    assert 'non-existing' in difference.comment
Exemple #6
0
def test_no_permissions_dir_in_tarball(monkeypatch, no_permissions_tar):
    # We want to make sure OSError is not raised.
    # Comparing with non-existing file makes it easy to make sure all files are unpacked
    monkeypatch.setattr(Config(), 'new_file', True)
    no_permissions_tar.compare(MissingFile('/nonexistent', no_permissions_tar))
Exemple #7
0
def compare_non_existing(monkeypatch, class1, decompiler):
    monkeypatch.setattr(Config(), 'new_file', True)
    monkeypatch.setattr(class1, 'decompilers', [decompiler])
    difference = class1.compare(MissingFile('/nonexisting', class1))
    assert difference.source2 == '/nonexisting'
    assert len(difference.details) > 0