Code Duplication    Length = 22-22 lines in 2 locations

tests/test_ssh_daemon.py 2 locations

@@ 114-135 (lines=22) @@
111
        self.assertIsInstance(res, list)
112
        self.assertEqual(commands, ['nice -n 10 cat /etc/passwd'])
113
114
    def test_run_command_legacy_credential(self):
115
        ospd_ssh.paramiko = fakeparamiko
116
117
        daemon = DummyWrapper(niceness=10)
118
        scanid = daemon.create_scan(
119
            None,
120
            {
121
                'target': 'host.example.com',
122
                'ports': '80, 443',
123
                'credentials': {},
124
                'exclude_hosts': '',
125
                'finished_hosts': '',
126
                'options': {},
127
            },
128
            dict(port=5, ssh_timeout=15, username='dummy', password='pw'),
129
            '',
130
        )
131
132
        res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd')
133
134
        self.assertIsInstance(res, list)
135
        self.assertEqual(commands, ['nice -n 10 cat /etc/passwd'])
136
137
    def test_run_command_new_credential(self):
138
        ospd_ssh.paramiko = fakeparamiko
@@ 91-112 (lines=22) @@
88
        with self.assertRaises(ImportError):
89
            OSPDaemonSimpleSSH()
90
91
    def test_run_command(self):
92
        ospd_ssh.paramiko = fakeparamiko
93
94
        daemon = DummyWrapper(niceness=10)
95
        scanid = daemon.create_scan(
96
            None,
97
            {
98
                'target': 'host.example.com',
99
                'ports': '80, 443',
100
                'credentials': {},
101
                'exclude_hosts': '',
102
                'finished_hosts': '',
103
                'options': {},
104
            },
105
            dict(port=5, ssh_timeout=15, username_password='dummy:pw'),
106
            '',
107
        )
108
109
        res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd')
110
111
        self.assertIsInstance(res, list)
112
        self.assertEqual(commands, ['nice -n 10 cat /etc/passwd'])
113
114
    def test_run_command_legacy_credential(self):
115
        ospd_ssh.paramiko = fakeparamiko