Esempio n. 1
0
def test_extract_files(original_mkp_file, tmpdir):
    package = mkp.load_bytes(original_mkp_file)

    package.extract_files(str(tmpdir))

    assert tmpdir.join('agents', 'special', 'agent_test').exists()
    assert tmpdir.join('checkman', 'test').exists()
    assert tmpdir.join('checkman', 'test').open().read() == 'title: Hello World!\n'
def test_extract_files(original_mkp_file, tmpdir):
    package = mkp.load_bytes(original_mkp_file)

    package.extract_files(str(tmpdir))

    assert tmpdir.join('agents', 'special', 'agent_test').exists()
    assert tmpdir.join('checkman', 'test').exists()
    assert tmpdir.join('checkman',
                       'test').open().read() == 'title: Hello World!\n'
Esempio n. 3
0
def test_pack_and_unpack_covers_all_known_directories(tmpdir):
    info = {
        'files': {key: ['test'] for key in DIRECTORIES},
    }
    source = tmpdir.join('source').mkdir()
    dest = tmpdir.join('dest').mkdir()

    for directory in DIRECTORIES:
        source.join(directory, 'test').write_binary(b'Foo', ensure=True)

    package_bytes = mkp.pack_to_bytes(info, str(source))
    package = mkp.load_bytes(package_bytes)
    package.extract_files(str(dest))

    for directory in DIRECTORIES:
        assert dest.join(directory, 'test').exists()
Esempio n. 4
0
def test_pack_and_unpack_covers_all_known_directories(tmpdir):
    info = {
        'files': {key: ['test']
                  for key in DIRECTORIES},
    }
    source = tmpdir.join('source').mkdir()
    dest = tmpdir.join('dest').mkdir()

    for directory in DIRECTORIES:
        source.join(directory, 'test').write_binary(b'Foo', ensure=True)

    package_bytes = mkp.pack_to_bytes(info, str(source))
    package = mkp.load_bytes(package_bytes)
    package.extract_files(str(dest))

    for directory in DIRECTORIES:
        assert dest.join(directory, 'test').exists()
def test_load_bytes_with_info_json(original_mkp_file_with_info_json):
    package = mkp.load_bytes(original_mkp_file_with_info_json)

    assert type(package) == mkp.Package
    assert package.info['title'] == 'Title of test'
    assert package.json_info['title'] == 'Title of test'
def test_load_bytes(original_mkp_file):
    package = mkp.load_bytes(original_mkp_file)

    assert type(package) == mkp.Package
    assert package.info['title'] == 'Title of test'
Esempio n. 7
0
def test_load_bytes(original_mkp_file):
    package = mkp.load_bytes(original_mkp_file)

    assert type(package) == mkp.Package
    assert package.info['title'] == 'Title of test'