fork/mons
git clone https://git.julia.blue/fork/mons
702009d
fixes
1import os 2 3import outputs 4import pytest 5 6from mons .mons import cli as mons_cli 7 8 9@ pytest . mark . prioritize 10@ pytest . mark . must_pass # All other tests rely on `mons add` 11def test_add (runner_result ,test_install_path ,test_name ): 12with runner_result (mons_cli , ["add" ,test_name ,test_install_path ])as result : 13assert result .exit_code == 0 14assert outputs .FOUND_INSTALL in result .output 15 16 17def test_add_fail (runner_result ,test_name ,tmp_path ): 18fake_path = os .path .join (tmp_path ,"fake_path" ) 19with runner_result (mons_cli , ["add" ,test_name ,fake_path ])as result : 20assert result .exception 21assert f"Path ' { fake_path } ' does not exist" in result .output 22 23os .mkdir (fake_path ) 24with runner_result (mons_cli , ["add" ,test_name ,fake_path ])as result : 25assert result .exception 26asm = "'Celeste.exe' or 'Celeste.dll'" 27assert f" { asm } could not be found" in result .output 28 29 30def test_rename (runner_result ,test_install ): 31with runner_result ( 32mons_cli , ["rename" ,test_install ,f" { test_install } _renamed" ] 33 )as result : 34assert result .exit_code == 0 35assert outputs .RENAMED_INSTALL in result .output 36 37 38def test_set_path (runner_result ,test_install ,test_install_path ): 39with runner_result ( 40mons_cli , ["set-path" ,test_install ,test_install_path ] 41 )as result : 42assert result .exit_code == 0 43assert outputs .FOUND_INSTALL in result .output 44 45 46def test_remove (runner_result ,test_install ): 47with runner_result (mons_cli , ["remove" ,test_install ,"--force" ])as result : 48assert result .exit_code == 0 49assert outputs .REMOVED_INSTALL in result .output 50 51 52def test_list (runner_result ,test_install ): 53with runner_result (mons_cli , ["list" ])as result : 54assert result .exit_code == 0 55assert test_install in result .output 56 57 58def test_list_empty (runner_result ): 59with runner_result (mons_cli , ["list" ])as result : 60assert result .exit_code != 0 ,result .output 61assert outputs .NO_INSTALLS_FOUND in result .output 62 63 64def test_show (runner_result ,test_install ): 65with runner_result (mons_cli , ["show" ,test_install ])as result : 66assert result .exit_code == 0 ,result .output 67assert test_install in result .output 68 69 70def test_launch (runner_result ,test_install ,test_install_path ): 71with runner_result (mons_cli , ["launch" ,test_install ,"--dry-run" ])as result : 72assert result .exit_code == 0 ,result .output 73assert ( 74os .path .join (os .path .dirname (test_install_path ),"Celeste" )in result .output 75 )