Esempio n. 1
0
	def test_it_correctly_generates_the_clickObject(self, click_command, pass_context):
		command = Command({'to': 'foo', 'hop': 'bar'})
		test_func = MagicMock()
		test_func.return_value = 'test_command'
		pass_context.return_value = 'test_function'
		click_command.return_value = test_func
		result = command.setClickObject()
		self.assertEquals(result, 'test_command')
		pass_context.assert_called_with(command.run)
		test_func.assert_called_with('test_function')
		click_command.assert_called_with(
			name = command.getName(),
			help = command.data.get('description'),
			context_settings = {
				'allow_extra_args': True,
				'allow_interspersed_args': True,
			}
		)
Esempio n. 2
0
	def test_it_returns_the_correct_name(self):
		data = {'to': 'foo', 'hop': 'test hopping groups'}
		command = Command(data)
		result = command.getName()
		self.assertEquals(result, 'groups')
Esempio n. 3
0
	def test_it_returns_None_with_no_name_set(self):
		data = {'to': 'foo', 'hop': None}
		command = Command(data)
		result = command.getName()
		self.assertEquals(result, None)