def test_put_file_delete_file(self): n = JubaNode('localhost', range(10000,10003), None, '/tmp', []) path = n.put_file(b'foo') self.assertTrue(os.path.isfile(path)) with open(path, 'rb') as f: self.assertEqual(b'foo', f.read()) n.delete_file(path) self.assertFalse(os.path.isfile(path))
def test_put_file(self): n = JubaNode('localhost', range(10000,10003), None, '/tmp', []) with tempfile.NamedTemporaryFile() as tmp: n.put_file(b'foo', tmp.name) self.assertEqual(b'foo', tmp.read())