コード例 #1
0
ファイル: test_inputs.py プロジェクト: GreenGremlin/sprinter
 def test_parse_param_line_with_dict(self):
     """ parse_param_line should accept a dict to configure itself """
     test_line = "test?==result#{'prompt':'would you like to do something?'}"
     value, config = self.inputs._parse_param_line(test_line)
     assert value == "test"
     test_config = Input()
     test_config.prompt = "would you like to do something?"
     test_config.is_secret = True
     test_config.default = "result"
     assert config == test_config
コード例 #2
0
ファイル: test_inputs.py プロジェクト: staylor32/sprinter
 def test_parse_param_line_with_dict(self):
     """ parse_param_line should accept a dict to configure itself """
     test_line = "test?==result#{'prompt':'would you like to do something?'}"
     value, config = self.inputs._parse_param_line(test_line)
     assert value == 'test'
     test_config = Input()
     test_config.prompt = 'would you like to do something?'
     test_config.is_secret = True
     test_config.default = 'result'
     assert config == test_config
コード例 #3
0
ファイル: test_inputs.py プロジェクト: GreenGremlin/sprinter
 def test_prompt_unset_imputs(self):
     """ Only unset inputs should be prompted with prompt_unset_inputs """
     self.inputs.add_input("key")
     key_with_value = Input()
     key_with_value.value = "value"
     self.inputs.add_input("key_with_value", key_with_value)
     with patch.object(lib, "prompt") as prompt:
         prompt.return_value = "yusuke"
         self.inputs.prompt_unset_inputs()
         prompt.assert_called_once_with("please enter your key", default=None, secret=False, bool_type=None)
コード例 #4
0
ファイル: test_inputs.py プロジェクト: GreenGremlin/sprinter
 def test_write_values(self):
     """ Only write values should be returned by write_values """
     secret = Input()
     secret.value = "value"
     secret.is_secret = True
     not_secret = Input()
     not_secret.value = "not_secret_value"
     self.inputs.add_input("secret_key", secret)
     self.inputs.add_input("not_secret_key", not_secret)
     tools.eq_(self.inputs.write_values(), {"not_secret_key": "not_secret_value"})
コード例 #5
0
 def test_prompt_unset_imputs(self):
     """ Only unset inputs should be prompted with prompt_unset_inputs """
     self.inputs.add_input('key')
     key_with_value = Input()
     key_with_value.value = 'value'
     self.inputs.add_input('key_with_value', key_with_value)
     with patch.object(lib, 'prompt') as prompt:
         prompt.return_value = "yusuke"
         self.inputs.prompt_unset_inputs()
         prompt.assert_called_once_with("please enter your key", default=None, secret=False, bool_type=None)
コード例 #6
0
ファイル: test_inputs.py プロジェクト: WmoT/sprinter
 def test_write_values(self):
     """ Only write values should be returned by write_values """
     secret = Input()
     secret.value = 'value'
     secret.is_secret = True
     not_secret = Input()
     not_secret.value = 'not_secret_value'
     self.inputs.add_input('secret_key', secret)
     self.inputs.add_input('not_secret_key', not_secret)
     tools.eq_(self.inputs.write_values(), {
         'not_secret_key': 'not_secret_value'
     })
コード例 #7
0
ファイル: test_inputs.py プロジェクト: WmoT/sprinter
 def test_forced_prompt_unset_imputs(self):
     """ Only all inputs should be prompted with prompt_unset_inputs and force=True """
     self.inputs.add_input('key')
     key_with_value = Input()
     key_with_value.value = 'value'
     self.inputs.add_input('key_with_value', key_with_value)
     with patch.object(lib, 'prompt') as prompt:
         prompt.return_value = "yusuke"
         self.inputs.prompt_unset_inputs(force=True)
         prompt.assert_has_calls([
             call("please enter your key", default=None, secret=False),
             call("please enter your key_with_value", default='value', secret=False),
         ])
コード例 #8
0
 def test_forced_prompt_unset_imputs(self):
     """ Only all inputs should be prompted with prompt_unset_inputs and force=True """
     self.inputs.add_input('key')
     key_with_value = Input()
     key_with_value.value = 'value'
     self.inputs.add_input('key_with_value', key_with_value)
     with patch.object(lib, 'prompt') as prompt:
         prompt.return_value = "yusuke"
         self.inputs.prompt_unset_inputs(force=True)
         prompt.assert_has_calls([
             call("please enter your key", default=None, secret=False, bool_type=None),
             call("please enter your key_with_value", default='value', secret=False, bool_type=None),
         ], any_order=True)
コード例 #9
0
ファイル: test_inputs.py プロジェクト: staylor32/sprinter
 def test_input_equality(self):
     a = Input()
     a.value = 'hi'
     a.is_secret = True
     b = Input()
     b.value = 'hi'
     b.is_secret = True
     assert a == b
コード例 #10
0
ファイル: test_inputs.py プロジェクト: GreenGremlin/sprinter
 def test_forced_prompt_unset_imputs(self):
     """ Only all inputs should be prompted with prompt_unset_inputs and force=True """
     self.inputs.add_input("key")
     key_with_value = Input()
     key_with_value.value = "value"
     self.inputs.add_input("key_with_value", key_with_value)
     with patch.object(lib, "prompt") as prompt:
         prompt.return_value = "yusuke"
         self.inputs.prompt_unset_inputs(force=True)
         prompt.assert_has_calls(
             [
                 call("please enter your key", default=None, secret=False, bool_type=None),
                 call("please enter your key_with_value", default="value", secret=False, bool_type=None),
             ],
             any_order=True,
         )
コード例 #11
0
ファイル: test_inputs.py プロジェクト: staylor32/sprinter
 def test_write_values(self):
     """ Only write values should be returned by write_values """
     secret = Input()
     secret.value = 'value'
     secret.is_secret = True
     not_secret = Input()
     not_secret.value = 'not_secret_value'
     self.inputs.add_input('secret_key', secret)
     self.inputs.add_input('not_secret_key', not_secret)
     tools.eq_(self.inputs.write_values(),
               {'not_secret_key': 'not_secret_value'})
コード例 #12
0
ファイル: test_inputs.py プロジェクト: GreenGremlin/sprinter
 def test_input_equality(self):
     a = Input()
     a.value = "hi"
     a.is_secret = True
     b = Input()
     b.value = "hi"
     b.is_secret = True
     assert a == b