def test_PUT_node_update_file_magic(self): """Test put_node to make a new file with content.""" cb = get_test_contentblob("FakeContent") cb.magic_hash = 'magic' self.store.add(cb) self.store.commit() new_file_path = u"~/Ubuntu One/a/b/c/file.txt" info = self.helper.put_node(self.user, new_file_path, { 'kind': 'file', 'hash': cb.hash, 'magic_hash': 'magic' }) cb = get_test_contentblob("NewFakeContent") cb.magic_hash = 'magic2' self.store.add(cb) self.store.commit() info = self.helper.put_node(self.user, new_file_path, { 'kind': 'file', 'hash': cb.hash, 'magic_hash': 'magic2' }) node = self.user.get_node_by_path(new_file_path, with_content=True) self.assertEqual(node.kind, 'File') self.assertEqual(node.full_path, '/a/b/c/file.txt') self.assertEqual(info, self.mapper.node_repr(node)) self.assertEqual(node.content.magic_hash, 'magic2')
def test_PUT_node_update_file_magic(self): """Test put_node to make a new file with content.""" cb = get_test_contentblob("FakeContent") cb.magic_hash = b'magic' self.store.add(cb) self.store.commit() new_file_path = "~/Ubuntu One/a/b/c/file.txt" info = self.helper.put_node( self.user, new_file_path, {'kind': 'file', 'hash': cb.hash, 'magic_hash': 'magic'}) cb = get_test_contentblob("NewFakeContent") cb.magic_hash = b'magic2' self.store.add(cb) self.store.commit() info = self.helper.put_node( self.user, new_file_path, {'kind': 'file', 'hash': cb.hash, 'magic_hash': 'magic2'}) node = self.user.get_node_by_path(new_file_path, with_content=True) self.assertEqual(node.kind, StorageObject.FILE) self.assertEqual(node.full_path, '/a/b/c/file.txt') self.assertEqual(info, self.mapper.node_repr(node)) self.assertEqual(node.content.magic_hash, 'magic2')
def test_PUT_node_new_file_magic(self): """Test put_node to make a new file with content.""" cb = get_test_contentblob("FakeContent") cb.magic_hash = 'magic' self.store.add(cb) self.store.commit() new_file_path = u"~/Ubuntu One/a/b/c/file.txt" info = self.helper.put_node( self.user, new_file_path, {'kind': 'file', 'hash': cb.hash, 'magic_hash': 'magic'}) node = self.user.get_node_by_path(new_file_path) self.assertEqual(node.kind, 'File') self.assertEqual(node.full_path, '/a/b/c/file.txt') self.assertEqual(info, self.mapper.node_repr(node))