Example #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
     })
Example #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
     })
Example #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
     })
Example #4
0
    def test_password_host_chainable(self):
        expected = {
            'pass': 'monkey_nuts',
            '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'])
Example #5
0
 def test_sudo(self):
     Accessor.sudo('echo boo')
     self.assertEqual(self.mock.last, {
         'command': 'echo boo',
         'sudo': True
     })
Example #6
0
 def test_run(self):
     Accessor.run('echo hello')
     self.assertEqual(self.mock.last, {
         'command': 'echo hello',
         'sudo': False
     })
Example #7
0
 def test_set_password(self):
     test_pass = 'monkey_balls'
     Accessor.password(test_pass)
     self.assertEqual(api.env['password'], test_pass)
Example #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)