Ejemplo n.º 1
0
def codebreaker_is_started(context):
    context.SECRET = "1234"
    context.input = mock()
    context.output = mock()
    reporter = OutputCli(context.output)
    context.wrapper = codebreaker_wrapper.codebreaker_wrapper(context.input, reporter)
    context.wrapper.generate_secret = lambda: context.SECRET
    context.wrapper.new_game()
 def play_game(self, guess):
     input = mock()
     output = mock()
     when(input).readline().thenReturn(guess)
     w = codebreaker_wrapper(input, output)
     w.generate_secret = lambda: "1234"
     w.new_game()
     w.next_guess()
     return output, w
Ejemplo n.º 3
0
def when_i_start_a_new_game(context):
    context.output = mock()
    reporter = OutputCli(context.output)
    input = mock()
    codebreaker_wrapper.codebreaker_wrapper(input, reporter)
Ejemplo n.º 4
0
import sys
sys.path.append("lib")

from codebreaker_wrapper import codebreaker_wrapper

sys.exit(codebreaker_wrapper().new_game().start())

    def test_generate_secret(self):
        w = codebreaker_wrapper(mock(), mock())
        w.randrange = lambda x: 2

        assert w.generate_secret() == "3456"