Exemplo n.º 1
0
def test_is_error_call_colision():
    filename1 = 'res/barkaerubar.txt'
    filename2 = 'res/barkaerufoo.txt'
    assert_string1 = 'string1'
    assert_string2 = 'string2'
    create_res_file(filename=filename1, assert_string=assert_string1)
    create_res_file(filename=filename2, assert_string=assert_string2)

    def assert_error_mes(ex):
        assert ex.returncode == 1
        assert ex.output.split('\n') == [
            ERROR_RES_MESSAGE,
            'barkaerubar.txt',
            'barkaerufoo.txt',
            ''
        ]

    try:
        subprocess.check_output(['./bin/boiler', 'barkaeru'])
    except subprocess.CalledProcessError as ex:
        assert_error_mes(ex)

    os.chdir('bin')
    try:
        subprocess.check_output(['./boiler', 'barkaeru'])
    except subprocess.CalledProcessError as ex:
        assert_error_mes(ex)
    init_all_test.go_root()

    delete_res_file(filename=filename1)
    delete_res_file(filename=filename2)
Exemplo n.º 2
0
def test_call_in_res_local():
    filename = 'res_local/barkaerubar.txt'
    assert_string = 'This is res_local barkaerubar.txt'
    create_res_file(filename=filename, assert_string=assert_string)

    bin_out = subprocess.check_output(['./bin/boiler', 'barkaerubar'])

    os.chdir('bin')
    no_bin_out = subprocess.check_output(['./boiler', 'barkaerubar'])
    init_all_test.go_root()

    delete_res_file(filename=filename)
    assert bin_out == assert_string
    assert no_bin_out == assert_string
import os
import subprocess
import init_all_test


# clone test directory
root = os.getcwd()
os.chdir('test')
subprocess.call(['git', 'clone', root, 'module/KaeruBoilerplate'])

init_all_test.go_root()


def create_kaeru_package():
    kaeru_package = (
        '{{"kaeru_test": "{root}/test/module/KaeruBoilerplate"}}'
        .format(root=root)
    )
    subprocess.call(
        ['mv', 'kaeru_package.json', 'test/tmp_kaeru_package.json'])
    with open('kaeru_package.json', 'w') as f:
        f.write(kaeru_package)


def test_set_boilerinstall():
    create_kaeru_package()
    result = subprocess.check_output(['bin/boilerinstall'])
    assert result.split('\n') == [
        (
            "\033[032mINFO: This package [{}] is installed!!\033[0m"
            .format("kaeru_test")