def test_get_file(self): n = JubaNode('localhost', range(10000,10003), None, '/tmp', []) with tempfile.NamedTemporaryFile() as tmp1, tempfile.NamedTemporaryFile() as tmp2: tmp1.write(b'bar') tmp1.flush() n.get_file(tmp1.name, tmp2.name) self.assertEqual(b'bar', tmp2.read())
def test_get_file_temp(self): n = JubaNode('localhost', range(10000,10003), None, '/tmp', []) contents_remote = n.get_file('/etc/hosts') with open('/etc/hosts', 'rb') as f: contents_local= f.read() self.assertEqual(contents_local, contents_remote)