-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send version info to server, use init files
- Loading branch information
Showing
9 changed files
with
97 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
__author__ = 'Sheeo' | ||
|
||
import os | ||
import pytest | ||
|
||
from fa.game_version import GameVersion | ||
from fa.mod import Mod | ||
from git import Version | ||
|
||
from config import Settings | ||
|
||
|
||
FAF_PATH = os.path.join(Settings.get('MODS_PATH', 'FA'), 'faf') | ||
|
||
@pytest.fixture(scope='function') | ||
def game_version(): | ||
return GameVersion(Version('binary-patch', 'master', None, 'a41659780460fd8829fce87b479beaa8ac78e474'), | ||
Mod('faf', FAF_PATH, Version('faf', '3634', None, 'ed052486a19f7adc1adb3f65451af1a7081d2339')), | ||
[], | ||
'') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,50 @@ | ||
from fa.init_file import InitFile | ||
|
||
__author__ = 'Sheeo' | ||
|
||
from flexmock import flexmock | ||
|
||
process_mock = flexmock() | ||
settings_mock = flexmock() | ||
|
||
import fa | ||
import fa.play | ||
|
||
fa.play.instance = process_mock | ||
fa.play.Settings = settings_mock | ||
|
||
|
||
def test_launches_process_with_given_arguments(game_version, tmpdir): | ||
game_info = { | ||
'uid': 0, | ||
'recorder': 'Sheeo', | ||
'version': game_version | ||
} | ||
expected_args = [('some-arg', 'test')] | ||
|
||
def validate_args(game_info, args, detach, init_file): | ||
for k, v in expected_args: | ||
assert k in dict(args).keys() | ||
assert dict(args)[k] == v | ||
return True | ||
|
||
settings_mock.should_receive('get').with_args('WRITE_GAME_LOG', 'FA').and_return(False) | ||
settings_mock.should_receive('get').with_args('BIN', 'FA').and_return(str(tmpdir)) | ||
process_mock.should_receive('run').replace_with(validate_args) | ||
assert fa.run(game_info, 0, expected_args) | ||
|
||
|
||
def test_launches_process_with_given_arguments(): | ||
def test_constructs_and_uses_init_file_from_game_version(game_version, tmpdir): | ||
game_info = { | ||
'uid': 0, | ||
'recorder': 'Sheeo' | ||
'recorder': 'Sheeo', | ||
'version': game_version | ||
} | ||
args = ['/some-arg', 'test'] | ||
process_mock.should_receive('run').with_args(game_info, args).and_return(True).once() | ||
assert fa.run(game_info, 0, args) | ||
settings_mock.should_receive('get').with_args('WRITE_GAME_LOG', 'FA').and_return(False) | ||
settings_mock.should_receive('get').with_args('BIN', 'FA').and_return(str(tmpdir)) | ||
|
||
def validate_args(game_info, args, detach, init_file): | ||
assert dict(args)['init'] == str(tmpdir.join('init_%s.lua' % game_version.main_mod.name)) | ||
return True | ||
process_mock.should_receive('run').replace_with(validate_args).once() | ||
assert fa.run(game_info, 0) |
623a824
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#138 ?