Exemple #1
0
 def test_append(self):
     Accessor.append('test.txt', 'hello there', False)
     self.assertEqual(self.mock.last, {
         'file': 'test.txt',
         'append': 'hello there',
         'sudo': False
     })
Exemple #2
0
 def test_put(self):
     Accessor.put('source file', 'destination file', False)
     self.assertEqual(self.mock.last, {
         'put': 'source file',
         'destination': 'destination file',
         'sudo': False
     })
Exemple #3
0
 def test_template(self):
     Accessor.template(
         'test.txt', '/etc/site', data={'test': False}, sudo=True)
     self.assertEqual(self.mock.last, {
         'template': 'test.txt',
         'destination': '/etc/site',
         'data': {'test': False},
         'sudo': True
     })
Exemple #4
0
    def test_password_host_chainable(self):
        expected = {
            'pass': '******',
            'host': 'your-mothers-house'
        }

        Accessor.password(expected['pass']) \
                .host(expected['host'])

        self.assertEqual(api.env['host_string'], expected['host'])
        self.assertEqual(api.env['password'], expected['pass'])
Exemple #5
0
 def test_sudo(self):
     Accessor.sudo('echo boo')
     self.assertEqual(self.mock.last, {
         'command': 'echo boo',
         'sudo': True
     })
Exemple #6
0
 def test_run(self):
     Accessor.run('echo hello')
     self.assertEqual(self.mock.last, {
         'command': 'echo hello',
         'sudo': False
     })
Exemple #7
0
 def test_set_password(self):
     test_pass = '******'
     Accessor.password(test_pass)
     self.assertEqual(api.env['password'], test_pass)
Exemple #8
0
 def test_set_host(self):
     test_host_name = 'my_test_host'
     Accessor.host(test_host_name)
     self.assertEqual(api.env['host_string'], test_host_name)