Ejemplo n.º 1
0
    def test_record_when_title_and_command_given(self):
        recorder = Recorder(self.pty_recorder)

        asciicast = recorder.record('ls -l', 'the title')

        assert_equal('the title', asciicast.title)
        assert_equal('ls -l', asciicast.command)
        assert_equal(('ls -l', ), self.pty_recorder.record_call_args())
        assert_equal(123.45, asciicast.duration)
        assert_equal(self.pty_recorder.stdout, asciicast.stdout)
Ejemplo n.º 2
0
    def test_record_when_title_and_command_given(self):
        recorder = Recorder(self.pty_recorder)

        asciicast = recorder.record('ls -l', 'the title')

        assert_equal('the title', asciicast.title)
        assert_equal('ls -l', asciicast.command)
        assert_equal(('ls -l',), self.pty_recorder.record_call_args())
        assert_equal(123.45, asciicast.duration)
        assert_equal(self.pty_recorder.stdout, asciicast.stdout)
Ejemplo n.º 3
0
    def test_record_when_no_title_nor_command_given(self):
        env = {'SHELL': '/bin/blush'}
        recorder = Recorder(self.pty_recorder, env)

        asciicast = recorder.record(None, None)

        assert_equal(None, asciicast.title)
        assert_equal(None, asciicast.command)
        assert_equal(('/bin/blush', ), self.pty_recorder.record_call_args())
        assert_equal(123.45, asciicast.duration)
        assert_equal(self.pty_recorder.stdout, asciicast.stdout)
Ejemplo n.º 4
0
    def test_record_when_no_title_nor_command_given(self):
        env = { 'SHELL': '/bin/blush' }
        recorder = Recorder(self.pty_recorder, env)

        asciicast = recorder.record(None, None)

        assert_equal(None, asciicast.title)
        assert_equal(None, asciicast.command)
        assert_equal(('/bin/blush',), self.pty_recorder.record_call_args())
        assert_equal(123.45, asciicast.duration)
        assert_equal(self.pty_recorder.stdout, asciicast.stdout)
Ejemplo n.º 5
0
 def __init__(self,
              api,
              filename,
              command,
              title,
              assume_yes,
              quiet,
              max_wait,
              recorder=None):
     Command.__init__(self, quiet)
     self.api = api
     self.filename = filename
     self.command = command
     self.title = title
     self.assume_yes = assume_yes or quiet
     self.max_wait = max_wait
     self.recorder = recorder if recorder is not None else Recorder()
Ejemplo n.º 6
0
 def __init__(self,
              api_url,
              api_token,
              cmd,
              title,
              skip_confirmation,
              recorder=None,
              uploader=None,
              confirmator=None):
     self.api_url = api_url
     self.api_token = api_token
     self.cmd = cmd
     self.title = title
     self.skip_confirmation = skip_confirmation
     self.recorder = recorder if recorder is not None else Recorder()
     self.uploader = uploader if uploader is not None else Uploader()
     self.confirmator = confirmator if confirmator is not None else Confirmator(
     )