Пример #1
0
    def test_start_no_additional_args(self, mocks):
        subject = NodeSshCommands(lambda: '1.2.3.4')
        node_args = {
            'dns-servers':
            '--dns-servers 1.1.1.1,8.8.8.8',
            'log-level':
            '--log-level debug',
            'data-directory':
            '--data-directory /tmp',
            'ip':
            '--ip 1.2.3.4',
            'earning-wallet':
            '--earning-wallet 0xF00DFACE',
            'consuming-private-key':
            '--consuming-private-key 89d59b93ef6a94c977e1812b727d5f123f7d825ab636e83aad3e2845a68eaedb',
        }
        self.mock_executor.return_value.execute_sync.return_value = 'started'

        result = subject.start(node_args)

        self.mock_executor.return_value.execute_sync.assert_called_with([
            'ssh', '-oStrictHostKeyChecking=no', '[email protected]',
            'sudo ./SubstratumNode', '--dns-servers', '1.1.1.1,8.8.8.8',
            '--log-level', 'debug', '--data-directory', '/tmp', '--ip',
            '1.2.3.4', '--earning-wallet', '0xF00DFACE',
            '--consuming-private-key',
            '89d59b93ef6a94c977e1812b727d5f123f7d825ab636e83aad3e2845a68eaedb',
            '>', '/dev/null', '2>&1', '&'
        ])
        assert result == 'started'
Пример #2
0
    def test_start(self, mocks):
        subject = NodeSshCommands(lambda: '1.2.3.4')
        args_map = {
            'dns-servers': '1.1.1.1,8.8.8.8',
            'log-level': 'debug',
            'data-directory': '/tmp',
            'ip': '1.2.3.4',
            'earning-wallet': '0xF00DFACE',
            'consuming-private-key':
            '89d59b93ef6a94c977e1812b727d5f123f7d825ab636e83aad3e2845a68eaedb',
            'neighbors': 'hi'
        }
        self.mock_executor.return_value.execute_sync.return_value = 'started'

        result = subject.start(args_map, 'irrelevant')

        self.mock_executor.return_value.execute_sync.assert_called_with([
            'ssh', '-oStrictHostKeyChecking=no', '[email protected]',
            'sudo ./MASQNode', '--consuming-private-key',
            '89d59b93ef6a94c977e1812b727d5f123f7d825ab636e83aad3e2845a68eaedb',
            '--data-directory', '/tmp', '--dns-servers', '1.1.1.1,8.8.8.8',
            '--earning-wallet', '0xF00DFACE', '--ip', '1.2.3.4', '--log-level',
            'debug', '--neighbors', 'hi', '>', '/dev/null', '2>&1', '&'
        ])

        assert result == 'started'