Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_update.py
# Copyright (C) 2017-2018 The Software Heritage developers | # Copyright (C) 2017-2018 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from django.core.urlresolvers import reverse | from django.core.urlresolvers import reverse | ||||
from nose.tools import istest | from nose.tools import istest | ||||
from rest_framework import status | from rest_framework import status | ||||
from rest_framework.test import APITestCase | from rest_framework.test import APITestCase | ||||
from swh.deposit.models import Deposit, DepositRequest | from swh.deposit.models import Deposit, DepositRequest | ||||
from swh.deposit.config import EDIT_SE_IRI, EM_IRI | from swh.deposit.config import EDIT_SE_IRI, EM_IRI | ||||
from ..common import BasicTestCase, WithAuthTestCase, CommonCreationRoutine | from ..common import BasicTestCase, WithAuthTestCase, CommonCreationRoutine | ||||
from ..common import FileSystemCreationRoutine, create_arborescence_zip | from ..common import FileSystemCreationRoutine, create_arborescence_archive | ||||
class DepositUpdateOrReplaceExistingDataTest( | class DepositUpdateOrReplaceExistingDataTest( | ||||
APITestCase, WithAuthTestCase, BasicTestCase, | APITestCase, WithAuthTestCase, BasicTestCase, | ||||
FileSystemCreationRoutine, CommonCreationRoutine): | FileSystemCreationRoutine, CommonCreationRoutine): | ||||
"""Try put/post (update/replace) query on EM_IRI | """Try put/post (update/replace) query on EM_IRI | ||||
""" | """ | ||||
def setUp(self): | def setUp(self): | ||||
super().setUp() | super().setUp() | ||||
self.atom_entry_data1 = b"""<?xml version="1.0"?> | self.atom_entry_data1 = b"""<?xml version="1.0"?> | ||||
<entry xmlns="http://www.w3.org/2005/Atom"> | <entry xmlns="http://www.w3.org/2005/Atom"> | ||||
<foobar>bar</foobar> | <foobar>bar</foobar> | ||||
</entry>""" | </entry>""" | ||||
self.atom_entry_data1 = b"""<?xml version="1.0"?> | self.atom_entry_data1 = b"""<?xml version="1.0"?> | ||||
<entry xmlns="http://www.w3.org/2005/Atom"> | <entry xmlns="http://www.w3.org/2005/Atom"> | ||||
<foobar>bar</foobar> | <foobar>bar</foobar> | ||||
</entry>""" | </entry>""" | ||||
self.archive2 = create_arborescence_zip( | self.archive2 = create_arborescence_archive( | ||||
self.root_path, 'archive2', 'file2', b'some other content in file') | self.root_path, 'archive2', 'file2', b'some other content in file') | ||||
@istest | @istest | ||||
def replace_archive_to_deposit_is_possible(self): | def replace_archive_to_deposit_is_possible(self): | ||||
"""Replace all archive with another one should return a 204 response | """Replace all archive with another one should return a 204 response | ||||
""" | """ | ||||
# given | # given | ||||
▲ Show 20 Lines • Show All 300 Lines • Show Last 20 Lines |