def test_install_rocket_files(session, roms_path): rkt.install('tests/fixtures/2048.rocket', roms_path, session) base_path = join(roms_path, 'nes', '2048') assert exists(join(base_path, 'logo.png')) assert exists(join(base_path, 'front.jpg')) assert exists(join(base_path, 'video1.gif')) assert exists(join(base_path, '2048 (tsone).nes')) assert exists(join(base_path, 'infos.yml'))
def test_install_rocket_with_good_infos(session, roms_path): rocket = rkt.install('tests/fixtures/2048.rocket', roms_path, session) description = '2048 is an originally Smartphone Game. You must play with tile to add them ' description += 'pair by pair to obtain 2048.' assert rocket.rom == '2048 (tsone).nes' assert rocket.name == '2048' assert rocket.description == description assert rocket.platform == 'nes' assert rocket.genres == 'Puzzle-Game' assert rocket.developper == 'tsone' assert rocket.publisher == 'tsone' assert rocket.players == [1] assert rocket.releasedate == date(2014, 6, 21)
def rocket(session, roms_path): yield rkt.install('tests/fixtures/2048.rocket', roms_path, session)
def test_install_rocket_into_database(session, roms_path): rocket = rkt.install('tests/fixtures/2048.rocket', roms_path, session) asserted = session.query(db.Rocket).filter_by(name='2048').first() assert rocket == asserted assert session.query(db.Rocket).count() == 1
def test_install_invalid_rocket_when_has_not_video_and_screenshot_file( session, roms_path): with pytest.raises(InstallError) as err: rkt.install('tests/fixtures/invalid5.rocket', roms_path, session) assert str(err.value) == 'This rocket has not video or screenshot file'
def test_install_invalid_rocket_when_has_not_rom_file(session, roms_path): with pytest.raises(InstallError) as err: rkt.install('tests/fixtures/invalid4.rocket', roms_path, session) assert str(err.value) == 'This rocket has not "2048 (tsone).nes" file'
def test_install_invalid_rocket_when_has_not_front_file(session, roms_path): with pytest.raises(InstallError) as err: rkt.install('tests/fixtures/invalid2.rocket', roms_path, session) assert str(err.value) == 'This rocket has not "front.jpg" file'