示例#1
0
	def test_user_dir_there(self, argparse, Remote, mock_os):
		mock_os.sep = real_os.sep
		parser = argparse.ArgumentParser.return_value
		mock_os.path.exists.return_value = True
		mock_raw_input = mock.MagicMock()
		mock_raw_input.return_value = 'user input'
		remote = Remote.return_value

		with mock.patch('__builtin__.raw_input', new=mock_raw_input):
			main.create([])
示例#2
0
	def test_normal(self, current_call, argparse, Remote, mock_os,
			build_config, development_build):
		mock_os.sep = real_os.sep
		parser = argparse.ArgumentParser.return_value
		parser.parse_args.return_value.name = None

		mock_os.path.exists.return_value = False

		call = current_call.return_value
		input = 'user input'
		call.wait_for_response.return_value = {'data': {'name': input}}

		remote = Remote.return_value
		build_config.load.return_value = tests.dummy_config()

		main.create([])

		mock_os.path.exists.assert_called_once_with(defaults.SRC_DIR)
		remote.create.assert_called_once_with(input)
		remote.fetch_initial.assert_called_once_with(remote.create.return_value)
		development_build.assert_called_once_with([])