diff --git a/swh/deposit/tests/api/test_common.py b/swh/deposit/tests/api/test_common.py --- a/swh/deposit/tests/api/test_common.py +++ b/swh/deposit/tests/api/test_common.py @@ -5,7 +5,6 @@ from django.core.urlresolvers import reverse -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -16,8 +15,7 @@ """Access to main entry point is ok without authentication """ - @istest - def get_home_is_ok(self): + def test_get_home_is_ok(self): """Without authentication, endpoint refuses access with 401 response """ @@ -31,8 +29,7 @@ """Access to main entry point is ok with authentication as well """ - @istest - def get_home_is_ok_2(self): + def test_get_home_is_ok_2(self): """Without authentication, endpoint refuses access with 401 response """ diff --git a/swh/deposit/tests/api/test_converters.py b/swh/deposit/tests/api/test_converters.py --- a/swh/deposit/tests/api/test_converters.py +++ b/swh/deposit/tests/api/test_converters.py @@ -3,7 +3,6 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from nose.tools import istest from rest_framework.test import APITestCase from swh.deposit.api.converters import convert_status_detail @@ -11,8 +10,7 @@ class ConvertersTestCase(APITestCase): - @istest - def convert_status_detail_empty(self): + def test_convert_status_detail_empty(self): actual_status_detail = convert_status_detail({}) self.assertIsNone(actual_status_detail) @@ -22,8 +20,7 @@ actual_status_detail = convert_status_detail(None) self.assertIsNone(actual_status_detail) - @istest - def convert_status_detail(self): + def test_convert_status_detail(self): status_detail = { 'url': { 'summary': "At least one url field must be compatible with the client\'s domain name. The following url fields failed the check", # noqa @@ -55,8 +52,7 @@ self.assertEqual(actual_status_detail, expected_status_detail) - @istest - def convert_status_detail_2(self): + def test_convert_status_detail_2(self): status_detail = { 'url': { 'summary': 'At least one compatible url field. Failed', @@ -90,8 +86,7 @@ self.assertEqual(actual_status_detail, expected_status_detail) - @istest - def convert_status_detail_3(self): + def test_convert_status_detail_3(self): status_detail = { 'url': { 'summary': 'At least one compatible url field', @@ -102,8 +97,7 @@ actual_status_detail = convert_status_detail(status_detail) self.assertEqual(actual_status_detail, expected_status_detail) - @istest - def convert_status_detail_edge_case(self): + def test_convert_status_detail_edge_case(self): status_detail = { 'url': { 'summary': 'At least one compatible url field. Failed', diff --git a/swh/deposit/tests/api/test_deposit.py b/swh/deposit/tests/api/test_deposit.py --- a/swh/deposit/tests/api/test_deposit.py +++ b/swh/deposit/tests/api/test_deposit.py @@ -7,7 +7,6 @@ from django.core.urlresolvers import reverse from io import BytesIO -from nose.tools import istest, nottest from rest_framework import status from rest_framework.test import APITestCase @@ -25,8 +24,7 @@ """Deposit access are protected with basic authentication. """ - @istest - def post_will_fail_with_401(self): + def test_post_will_fail_with_401(self): """Without authentication, endpoint refuses access with 401 response """ @@ -54,8 +52,7 @@ _user.collections = [_collection2.id] self.collection2 = _collection2 - @istest - def access_to_another_user_collection_is_forbidden(self): + def test_access_to_another_user_collection_is_forbidden(self): """Access to another user collection should return a 403 """ @@ -67,8 +64,7 @@ 'Client hal cannot access collection %s' % ( self.collection2.name, )) - @istest - def delete_on_col_iri_not_supported(self): + def test_delete_on_col_iri_not_supported(self): """Delete on col iri should return a 405 response """ @@ -79,7 +75,6 @@ self.assertRegex(response.content.decode('utf-8'), 'DELETE method is not supported on this endpoint') - @nottest def create_deposit_with_rejection_status(self): url = reverse(COL_IRI, args=[self.collection.name]) @@ -105,8 +100,7 @@ actual_state = response_content['deposit_status'] self.assertEquals(actual_state, DEPOSIT_STATUS_REJECTED) - @istest - def act_on_deposit_rejected_is_not_permitted(self): + def test_act_on_deposit_rejected_is_not_permitted(self): deposit_id = self.create_deposit_with_status(DEPOSIT_STATUS_REJECTED) deposit = Deposit.objects.get(pk=deposit_id) @@ -124,8 +118,7 @@ "You can only act on deposit with status '%s'" % ( DEPOSIT_STATUS_PARTIAL, )) - @istest - def add_deposit_with_parent(self): + def test_add_deposit_with_parent(self): # given multiple deposit already loaded deposit_id = self.create_deposit_with_status( status=DEPOSIT_STATUS_LOAD_SUCCESS, diff --git a/swh/deposit/tests/api/test_deposit_atom.py b/swh/deposit/tests/api/test_deposit_atom.py --- a/swh/deposit/tests/api/test_deposit_atom.py +++ b/swh/deposit/tests/api/test_deposit_atom.py @@ -5,7 +5,6 @@ from django.core.urlresolvers import reverse from io import BytesIO -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -251,8 +250,7 @@ """ # noqa - @istest - def post_deposit_atom_entry_serialization_error(self): + def test_post_deposit_atom_entry_serialization_error(self): """Posting an initial atom entry should return 201 with deposit receipt """ @@ -278,8 +276,7 @@ sw_version = dr.metadata.get('codemeta:softwareVersion') self.assertEquals(sw_version, '10.4') - @istest - def post_deposit_atom_empty_body_request(self): + def test_post_deposit_atom_empty_body_request(self): """Posting empty body request should return a 400 response """ @@ -289,8 +286,7 @@ data=self.atom_entry_data_empty_body) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - @istest - def post_deposit_atom_badly_formatted_is_a_bad_request(self): + def test_post_deposit_atom_badly_formatted_is_a_bad_request(self): """Posting a badly formatted atom should return a 400 response """ @@ -300,8 +296,7 @@ data=self.atom_entry_data_badly_formatted) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - @istest - def post_deposit_atom_without_slug_header_is_bad_request(self): + def test_post_deposit_atom_without_slug_header_is_bad_request(self): """Posting an atom entry without a slug header should return a 400 """ @@ -319,8 +314,7 @@ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - @istest - def post_deposit_atom_unknown_collection(self): + def test_post_deposit_atom_unknown_collection(self): """Posting an atom entry to an unknown collection should return a 404 """ @@ -331,8 +325,7 @@ HTTP_SLUG='something') self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) - @istest - def post_deposit_atom_entry_initial(self): + def test_post_deposit_atom_entry_initial(self): """Posting an initial atom entry should return 201 with deposit receipt """ @@ -371,8 +364,7 @@ deposit_request.raw_metadata, atom_entry_data.decode('utf-8')) self.assertFalse(bool(deposit_request.archive)) - @istest - def post_deposit_atom_entry_with_codemeta(self): + def test_post_deposit_atom_entry_with_codemeta(self): """Posting an initial atom entry should return 201 with deposit receipt """ @@ -414,7 +406,6 @@ self.assertFalse(bool(deposit_request.archive)) - @istest def test_post_deposit_atom_entry_tei(self): """Posting initial atom entry as TEI should return 201 with receipt @@ -453,8 +444,7 @@ deposit_request.raw_metadata, atom_entry_data.decode('utf-8')) self.assertFalse(bool(deposit_request.archive)) - @istest - def post_deposit_atom_entry_multiple_steps(self): + def test_post_deposit_atom_entry_multiple_steps(self): """After initial deposit, updating a deposit should return a 201 """ diff --git a/swh/deposit/tests/api/test_deposit_binary.py b/swh/deposit/tests/api/test_deposit_binary.py --- a/swh/deposit/tests/api/test_deposit_binary.py +++ b/swh/deposit/tests/api/test_deposit_binary.py @@ -6,7 +6,6 @@ from django.core.files.uploadedfile import InMemoryUploadedFile from django.core.urlresolvers import reverse from io import BytesIO -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -125,8 +124,7 @@ """ - @istest - def post_deposit_binary_without_slug_header_is_bad_request(self): + def test_post_deposit_binary_without_slug_header_is_bad_request(self): """Posting a binary deposit without slug header should return 400 """ @@ -148,8 +146,7 @@ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - @istest - def post_deposit_binary_upload_final_and_status_check(self): + def test_post_deposit_binary_upload_final_and_status_check(self): """Binary upload with correct headers should return 201 with receipt """ @@ -205,8 +202,7 @@ self.assertEqual(response._headers['location'], ('Location', 'http://testserver' + edit_se_iri)) - @istest - def post_deposit_binary_upload_supports_zip_or_tar(self): + def test_post_deposit_binary_upload_supports_zip_or_tar(self): """Binary upload with content-type not in [zip,x-tar] should return 415 """ @@ -235,8 +231,7 @@ with self.assertRaises(Deposit.DoesNotExist): Deposit.objects.get(external_id=external_id) - @istest - def post_deposit_binary_fails_if_unsupported_packaging_header( + def test_post_deposit_binary_fails_if_unsupported_packaging_header( self): """Bin deposit without supported content_disposition header returns 400 @@ -264,8 +259,7 @@ with self.assertRaises(Deposit.DoesNotExist): Deposit.objects.get(external_id=external_id) - @istest - def post_deposit_binary_upload_fail_if_no_content_disposition_header( + def test_post_deposit_binary_upload_fail_if_no_content_disposition_header( self): """Binary upload without content_disposition header should return 400 @@ -293,8 +287,7 @@ with self.assertRaises(Deposit.DoesNotExist): Deposit.objects.get(external_id=external_id) - @istest - def post_deposit_mediation_not_supported(self): + def test_post_deposit_mediation_not_supported(self): """Binary upload with mediation should return a 412 response """ @@ -324,8 +317,7 @@ with self.assertRaises(Deposit.DoesNotExist): Deposit.objects.get(external_id=external_id) - @istest - def post_deposit_binary_upload_fail_if_upload_size_limit_exceeded( + def test_post_deposit_binary_upload_fail_if_upload_size_limit_exceeded( self): """Binary upload must not exceed the limit set up... @@ -360,8 +352,7 @@ with self.assertRaises(Deposit.DoesNotExist): Deposit.objects.get(external_id=external_id) - @istest - def post_deposit_2_post_2_different_deposits(self): + def test_post_deposit_2_post_2_different_deposits(self): """2 posting deposits should return 2 different 201 with receipt """ @@ -418,8 +409,7 @@ self.assertEqual(len(deposits), 2) self.assertEqual(list(deposits), [deposit, deposit2]) - @istest - def post_deposit_binary_and_post_to_add_another_archive(self): + def test_post_deposit_binary_and_post_to_add_another_archive(self): """Updating a deposit should return a 201 with receipt """ @@ -509,8 +499,7 @@ deposits = Deposit.objects.all() self.assertEqual(len(deposits), 1) - @istest - def post_deposit_then_post_or_put_is_refused_when_status_ready(self): + def test_post_deposit_then_post_or_put_is_refused_when_status_ready(self): """Updating a deposit with status 'ready' should return a 400 """ diff --git a/swh/deposit/tests/api/test_deposit_check.py b/swh/deposit/tests/api/test_deposit_check.py --- a/swh/deposit/tests/api/test_deposit_check.py +++ b/swh/deposit/tests/api/test_deposit_check.py @@ -6,7 +6,6 @@ import unittest from django.core.urlresolvers import reverse -from nose.tools import istest from nose.plugins.attrib import attr from rest_framework import status from rest_framework.test import APITestCase @@ -37,8 +36,7 @@ def setUp(self): super().setUp() - @istest - def deposit_ok(self): + def test_deposit_ok(self): """Proper deposit should succeed the checks (-> status ready) """ @@ -60,8 +58,7 @@ deposit = Deposit.objects.get(pk=deposit.id) self.assertEquals(deposit.status, DEPOSIT_STATUS_VERIFIED) - @istest - def deposit_invalid_tarball(self): + def test_deposit_invalid_tarball(self): """Deposit with tarball (of 1 tarball) should fail the checks: rejected """ @@ -89,8 +86,7 @@ deposit = Deposit.objects.get(pk=deposit.id) self.assertEquals(deposit.status, DEPOSIT_STATUS_REJECTED) - @istest - def deposit_ko_missing_tarball(self): + def test_deposit_ko_missing_tarball(self): """Deposit without archive should fail the checks: rejected """ @@ -114,8 +110,7 @@ deposit = Deposit.objects.get(pk=deposit.id) self.assertEquals(deposit.status, DEPOSIT_STATUS_REJECTED) - @istest - def deposit_ko_unsupported_tarball(self): + def test_deposit_ko_unsupported_tarball(self): """Deposit with an unsupported tarball should fail the checks: rejected """ @@ -152,8 +147,7 @@ deposit = Deposit.objects.get(pk=deposit.id) self.assertEquals(deposit.status, DEPOSIT_STATUS_REJECTED) - @istest - def check_deposit_metadata_ok(self): + def test_check_deposit_metadata_ok(self): """Proper deposit should succeed the checks (-> status ready) with all **MUST** metadata @@ -180,8 +174,7 @@ class CheckMetadata(unittest.TestCase, SWHChecksDeposit): - @istest - def check_metadata_ok(self): + def test_check_metadata_ok(self): actual_check, detail = self._check_metadata({ 'url': 'something', 'external_identifier': 'something-else', @@ -192,8 +185,7 @@ self.assertTrue(actual_check) self.assertIsNone(detail) - @istest - def check_metadata_ok2(self): + def test_check_metadata_ok2(self): actual_check, detail = self._check_metadata({ 'url': 'something', 'external_identifier': 'something-else', @@ -204,8 +196,7 @@ self.assertTrue(actual_check) self.assertIsNone(detail) - @istest - def check_metadata_ko(self): + def test_check_metadata_ko(self): """Missing optional field should be caught """ @@ -224,8 +215,7 @@ self.assertFalse(actual_check) self.assertEqual(error_detail, expected_error) - @istest - def check_metadata_ko2(self): + def test_check_metadata_ko2(self): """Missing mandatory fields should be caught """ diff --git a/swh/deposit/tests/api/test_deposit_delete.py b/swh/deposit/tests/api/test_deposit_delete.py --- a/swh/deposit/tests/api/test_deposit_delete.py +++ b/swh/deposit/tests/api/test_deposit_delete.py @@ -4,7 +4,6 @@ # See top-level LICENSE file for more information from django.core.urlresolvers import reverse -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -19,8 +18,7 @@ class DepositDeleteTest(APITestCase, WithAuthTestCase, BasicTestCase, CommonCreationRoutine): - @istest - def delete_archive_on_partial_deposit_works(self): + def test_delete_archive_on_partial_deposit_works(self): """Removing partial deposit's archive should return a 204 response """ @@ -52,8 +50,7 @@ self.assertEquals(requests[0].type.name, 'metadata') self.assertEquals(requests[1].type.name, 'metadata') - @istest - def delete_archive_on_undefined_deposit_fails(self): + def test_delete_archive_on_undefined_deposit_fails(self): """Delete undefined deposit returns a 404 response """ @@ -63,8 +60,7 @@ # then self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) - @istest - def delete_archive_on_non_partial_deposit_fails(self): + def test_delete_archive_on_non_partial_deposit_fails(self): """Delete !partial status deposit should return a 400 response""" deposit_id = self.create_deposit_ready() deposit = Deposit.objects.get(pk=deposit_id) @@ -78,8 +74,7 @@ deposit = Deposit.objects.get(pk=deposit_id) self.assertIsNotNone(deposit) - @istest - def delete_partial_deposit_works(self): + def test_delete_partial_deposit_works(self): """Delete deposit should return a 204 response """ @@ -99,8 +94,7 @@ deposits = list(Deposit.objects.filter(pk=deposit_id)) self.assertEquals(deposits, []) - @istest - def delete_on_edit_se_iri_cannot_delete_non_partial_deposit(self): + def test_delete_on_edit_se_iri_cannot_delete_non_partial_deposit(self): """Delete !partial deposit should return a 400 response """ diff --git a/swh/deposit/tests/api/test_deposit_list.py b/swh/deposit/tests/api/test_deposit_list.py --- a/swh/deposit/tests/api/test_deposit_list.py +++ b/swh/deposit/tests/api/test_deposit_list.py @@ -4,7 +4,6 @@ # See top-level LICENSE file for more information from django.core.urlresolvers import reverse -from nose.tools import istest from nose.plugins.attrib import attr from rest_framework import status from rest_framework.test import APITestCase @@ -25,8 +24,7 @@ def setUp(self): super().setUp() - @istest - def deposit_list(self): + def test_deposit_list(self): """Deposit list api should return the deposits """ diff --git a/swh/deposit/tests/api/test_deposit_multipart.py b/swh/deposit/tests/api/test_deposit_multipart.py --- a/swh/deposit/tests/api/test_deposit_multipart.py +++ b/swh/deposit/tests/api/test_deposit_multipart.py @@ -6,7 +6,6 @@ from django.core.files.uploadedfile import InMemoryUploadedFile from django.core.urlresolvers import reverse from io import BytesIO -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -64,8 +63,7 @@ Type """ - @istest - def post_deposit_multipart_without_slug_header_is_bad_request(self): + def test_post_deposit_multipart_without_slug_header_is_bad_request(self): # given url = reverse(COL_IRI, args=[self.collection.name]) data_atom_entry = self.data_atom_entry_ok @@ -102,8 +100,7 @@ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - @istest - def post_deposit_multipart_zip(self): + def test_post_deposit_multipart_zip(self): """one multipart deposit (zip+xml) should be accepted """ @@ -172,8 +169,7 @@ self.assertEquals(deposit_request.raw_metadata, data_atom_entry.decode('utf-8')) - @istest - def post_deposit_multipart_tar(self): + def test_post_deposit_multipart_tar(self): """one multipart deposit (tar+xml) should be accepted """ @@ -242,8 +238,7 @@ self.assertEquals(deposit_request.raw_metadata, data_atom_entry.decode('utf-8')) - @istest - def post_deposit_multipart_put_to_replace_metadata(self): + def test_post_deposit_multipart_put_to_replace_metadata(self): """One multipart deposit followed by a metadata update should be accepted @@ -345,8 +340,7 @@ # FAILURE scenarios - @istest - def post_deposit_multipart_only_archive_and_atom_entry(self): + def test_post_deposit_multipart_only_archive_and_atom_entry(self): """Multipart deposit only accepts one archive and one atom+xml""" # given url = reverse(COL_IRI, args=[self.collection.name]) diff --git a/swh/deposit/tests/api/test_deposit_read_archive.py b/swh/deposit/tests/api/test_deposit_read_archive.py --- a/swh/deposit/tests/api/test_deposit_read_archive.py +++ b/swh/deposit/tests/api/test_deposit_read_archive.py @@ -7,7 +7,6 @@ import os from django.core.urlresolvers import reverse -from nose.tools import istest from nose.plugins.attrib import attr from rest_framework import status from rest_framework.test import APITestCase @@ -31,8 +30,7 @@ self.root_path, 'archive2', 'file2', b'some other content in file') self.workdir = os.path.join(self.root_path, 'workdir') - @istest - def access_to_existing_deposit_with_one_archive(self): + def test_access_to_existing_deposit_with_one_archive(self): """Access to deposit should stream a 200 response with its raw content """ @@ -71,8 +69,7 @@ self.assertNotEqual(actual_sha1, self.archive['sha1sum']) self.assertNotEqual(actual_sha1, self.archive2['sha1sum']) - @istest - def access_to_existing_deposit_with_multiple_archives(self): + def test_access_to_existing_deposit_with_multiple_archives(self): """Access to deposit should stream a 200 response with its raw contents """ @@ -98,8 +95,7 @@ class DepositReadArchivesFailureTest(APITestCase, WithAuthTestCase, BasicTestCase, CommonCreationRoutine): - @istest - def access_to_nonexisting_deposit_returns_404_response(self): + def test_access_to_nonexisting_deposit_returns_404_response(self): """Read unknown collection should return a 404 response """ @@ -113,8 +109,7 @@ self.assertIn('Deposit with id %s does not exist' % unknown_id, response.content.decode('utf-8')) - @istest - def access_to_nonexisting_collection_returns_404_response(self): + def test_access_to_nonexisting_collection_returns_404_response(self): """Read unknown deposit should return a 404 response """ diff --git a/swh/deposit/tests/api/test_deposit_read_metadata.py b/swh/deposit/tests/api/test_deposit_read_metadata.py --- a/swh/deposit/tests/api/test_deposit_read_metadata.py +++ b/swh/deposit/tests/api/test_deposit_read_metadata.py @@ -5,7 +5,6 @@ from django.core.urlresolvers import reverse -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -24,8 +23,7 @@ """Deposit access to read metadata information on deposit. """ - @istest - def read_metadata(self): + def test_read_metadata(self): """Private metadata read api to existing deposit should return metadata """ @@ -91,8 +89,7 @@ self.assertEquals(data, expected_meta) - @istest - def read_metadata_revision_with_parent(self): + def test_read_metadata_revision_with_parent(self): """Private read metadata to a deposit (with parent) returns metadata """ @@ -178,8 +175,7 @@ self.assertEqual(data, expected_meta) - @istest - def access_to_nonexisting_deposit_returns_404_response(self): + def test_access_to_nonexisting_deposit_returns_404_response(self): """Read unknown collection should return a 404 response """ @@ -193,8 +189,7 @@ self.assertIn('Deposit with id %s does not exist' % unknown_id, response.content.decode('utf-8')) - @istest - def access_to_nonexisting_collection_returns_404_response(self): + def test_access_to_nonexisting_collection_returns_404_response(self): """Read unknown deposit should return a 404 response """ diff --git a/swh/deposit/tests/api/test_deposit_status.py b/swh/deposit/tests/api/test_deposit_status.py --- a/swh/deposit/tests/api/test_deposit_status.py +++ b/swh/deposit/tests/api/test_deposit_status.py @@ -6,7 +6,6 @@ from django.core.urlresolvers import reverse from io import BytesIO -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -25,8 +24,7 @@ """Status on deposit """ - @istest - def post_deposit_with_status_check(self): + def test_post_deposit_with_status_check(self): """Binary upload should be accepted """ @@ -67,8 +65,7 @@ self.assertEqual(r['deposit_status_detail'], DEPOSIT_STATUS_DETAIL[DEPOSIT_STATUS_DEPOSITED]) - @istest - def status_with_swh_information(self): + def test_status_with_swh_information(self): _status = DEPOSIT_STATUS_LOAD_SUCCESS _context = 'https://hal.archives-ouvertes.fr/hal-01727745' _swh_id = 'swh:1:dir:42a13fc721c8716ff695d0d62fc851d641f3a12b' @@ -103,16 +100,14 @@ self.assertEqual(r['deposit_swh_anchor_id_context'], _swh_anchor_id_context) - @istest - def status_on_unknown_deposit(self): + def test_status_on_unknown_deposit(self): """Asking for the status of unknown deposit returns 404 response""" status_url = reverse(STATE_IRI, args=[self.collection.name, 999]) status_response = self.client.get(status_url) self.assertEqual(status_response.status_code, status.HTTP_404_NOT_FOUND) - @istest - def status_with_http_accept_header_should_not_break(self): + def test_status_with_http_accept_header_should_not_break(self): """Asking deposit status with Accept header should return 200 """ @@ -126,8 +121,7 @@ self.assertEqual(response.status_code, status.HTTP_200_OK) - @istest - def status_on_deposit_rejected(self): + def test_status_on_deposit_rejected(self): _status = DEPOSIT_STATUS_REJECTED _swh_id = '548b3c0a2bb43e1fca191e24b5803ff6b3bc7c10' _status_detail = {'url': {'summary': 'Wrong url'}} diff --git a/swh/deposit/tests/api/test_deposit_update.py b/swh/deposit/tests/api/test_deposit_update.py --- a/swh/deposit/tests/api/test_deposit_update.py +++ b/swh/deposit/tests/api/test_deposit_update.py @@ -4,7 +4,6 @@ # See top-level LICENSE file for more information from django.core.urlresolvers import reverse -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -37,8 +36,7 @@ self.archive2 = create_arborescence_archive( self.root_path, 'archive2', 'file2', b'some other content in file') - @istest - def replace_archive_to_deposit_is_possible(self): + def test_replace_archive_to_deposit_is_possible(self): """Replace all archive with another one should return a 204 response """ @@ -96,8 +94,7 @@ deposit=deposit, type=self.deposit_request_types['metadata'])) self.assertEquals(len(requests), 1) - @istest - def replace_metadata_to_deposit_is_possible(self): + def test_replace_metadata_to_deposit_is_possible(self): """Replace all metadata with another one should return a 204 response """ @@ -137,8 +134,7 @@ deposit=deposit, type=self.deposit_request_types['archive'])) self.assertEquals(len(requests), 1) - @istest - def add_archive_to_deposit_is_possible(self): + def test_add_archive_to_deposit_is_possible(self): """Add another archive to a deposit return a 201 response """ @@ -191,8 +187,7 @@ deposit=deposit, type=self.deposit_request_types['metadata'])) self.assertEquals(len(requests), 0) - @istest - def add_metadata_to_deposit_is_possible(self): + def test_add_metadata_to_deposit_is_possible(self): """Add metadata with another one should return a 204 response """ @@ -239,8 +234,7 @@ """Failure scenario about add/replace (post/put) query on deposit. """ - @istest - def add_metadata_to_unknown_collection(self): + def test_add_metadata_to_unknown_collection(self): """Replacing metadata to unknown deposit should return a 404 response """ @@ -253,8 +247,7 @@ self.assertRegex(response.content.decode('utf-8'), 'Unknown collection name test') - @istest - def add_metadata_to_unknown_deposit(self): + def test_add_metadata_to_unknown_deposit(self): """Replacing metadata to unknown deposit should return a 404 response """ @@ -267,8 +260,7 @@ self.assertRegex(response.content.decode('utf-8'), 'Deposit with id 999 does not exist') - @istest - def replace_metadata_to_unknown_deposit(self): + def test_replace_metadata_to_unknown_deposit(self): """Adding metadata to unknown deposit should return a 404 response """ @@ -281,8 +273,7 @@ self.assertRegex(response.content.decode('utf-8'), 'Deposit with id 998 does not exist') - @istest - def add_archive_to_unknown_deposit(self): + def test_add_archive_to_unknown_deposit(self): """Adding metadata to unknown deposit should return a 404 response """ @@ -295,8 +286,7 @@ self.assertRegex(response.content.decode('utf-8'), 'Deposit with id 997 does not exist') - @istest - def replace_archive_to_unknown_deposit(self): + def test_replace_archive_to_unknown_deposit(self): """Replacing archive to unknown deposit should return a 404 response """ @@ -309,8 +299,7 @@ self.assertRegex(response.content.decode('utf-8'), 'Deposit with id 996 does not exist') - @istest - def post_metadata_to_em_iri_failure(self): + def test_post_metadata_to_em_iri_failure(self): """Update (POST) archive with wrong content type should return 400 """ @@ -325,8 +314,7 @@ 'Packaging format supported is restricted to ' 'application/zip, application/x-tar') - @istest - def put_metadata_to_em_iri_failure(self): + def test_put_metadata_to_em_iri_failure(self): """Update (PUT) archive with wrong content type should return 400 """ diff --git a/swh/deposit/tests/api/test_deposit_update_status.py b/swh/deposit/tests/api/test_deposit_update_status.py --- a/swh/deposit/tests/api/test_deposit_update_status.py +++ b/swh/deposit/tests/api/test_deposit_update_status.py @@ -6,7 +6,6 @@ import json from django.core.urlresolvers import reverse -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -29,8 +28,7 @@ self.deposit = Deposit.objects.get(pk=deposit.id) assert self.deposit.status == DEPOSIT_STATUS_VERIFIED - @istest - def update_deposit_status(self): + def test_update_deposit_status(self): """Existing status for update should return a 204 response """ @@ -51,8 +49,7 @@ deposit = Deposit.objects.get(pk=self.deposit.id) self.assertEquals(deposit.status, _status) - @istest - def update_deposit_status_with_info(self): + def test_update_deposit_status_with_info(self): """Existing status for update with info should return a 204 response """ @@ -90,8 +87,7 @@ self.assertEquals(deposit.swh_anchor_id_context, expected_swh_anchor_id_context) - @istest - def update_deposit_status_will_fail_with_unknown_status(self): + def test_update_deposit_status_will_fail_with_unknown_status(self): """Unknown status for update should return a 400 response """ @@ -105,8 +101,7 @@ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - @istest - def update_deposit_status_will_fail_with_no_status_key(self): + def test_update_deposit_status_will_fail_with_no_status_key(self): """No status provided for update should return a 400 response """ @@ -120,8 +115,7 @@ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - @istest - def update_deposit_status_success_without_swh_id_fail(self): + def test_update_deposit_status_success_without_swh_id_fail(self): """Providing successful status without swh_id should return a 400 """ diff --git a/swh/deposit/tests/api/test_parser.py b/swh/deposit/tests/api/test_parser.py --- a/swh/deposit/tests/api/test_parser.py +++ b/swh/deposit/tests/api/test_parser.py @@ -6,7 +6,6 @@ import io from collections import OrderedDict -from nose.tools import istest from rest_framework.test import APITestCase from swh.deposit.parsers import SWHXMLParser @@ -16,8 +15,7 @@ """Access to main entry point is ok without authentication """ - @istest - def parsing_without_duplicates(self): + def test_parsing_without_duplicates(self): xml_no_duplicate = io.BytesIO(b''' @@ -53,8 +51,7 @@ ('codemeta:issueTracker', 'http://issuetracker.com')]) self.assertEqual(expected_dict, actual_result) - @istest - def parsing_with_duplicates(self): + def test_parsing_with_duplicates(self): xml_with_duplicates = io.BytesIO(b''' diff --git a/swh/deposit/tests/api/test_service_document.py b/swh/deposit/tests/api/test_service_document.py --- a/swh/deposit/tests/api/test_service_document.py +++ b/swh/deposit/tests/api/test_service_document.py @@ -4,7 +4,6 @@ # See top-level LICENSE file for more information from django.core.urlresolvers import reverse -from nose.tools import istest from rest_framework import status from rest_framework.test import APITestCase @@ -17,8 +16,7 @@ """Service document endpoints are protected with basic authentication. """ - @istest - def service_document_no_authentication_fails(self): + def test_service_document_no_authentication_fails(self): """Without authentication, service document endpoint should return 401 """ @@ -28,8 +26,7 @@ self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) - @istest - def service_document_with_http_accept_should_not_break(self): + def test_service_document_with_http_accept_should_not_break(self): """Without auth, sd endpoint through browser should return 401 """ @@ -79,8 +76,7 @@ self.username, self.username)) # noqa - @istest - def service_document(self): + def test_service_document(self): """With authentication, service document list user's collection """ @@ -92,8 +88,7 @@ # then self.assertResponseOk(response) - @istest - def service_document_with_http_accept_header(self): + def test_service_document_with_http_accept_header(self): """With authentication, with browser, sd list user's collection """ diff --git a/swh/deposit/tests/loader/test_checker.py b/swh/deposit/tests/loader/test_checker.py --- a/swh/deposit/tests/loader/test_checker.py +++ b/swh/deposit/tests/loader/test_checker.py @@ -3,7 +3,6 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from nose.tools import istest from rest_framework.test import APITestCase from swh.deposit.models import Deposit @@ -31,8 +30,7 @@ # 3. setup loader with no persistence and that client self.checker = DepositChecker(client=checker_client) - @istest - def check_deposit_ready(self): + def test_check_deposit_ready(self): """Check on a valid 'deposited' deposit should result in 'verified' """ @@ -51,8 +49,7 @@ self.assertEquals(deposit.status, DEPOSIT_STATUS_VERIFIED) self.assertEquals(actual_result, {'status': 'eventful'}) - @istest - def check_deposit_rejected(self): + def test_check_deposit_rejected(self): """Check on invalid 'deposited' deposit should result in 'rejected' """ diff --git a/swh/deposit/tests/loader/test_client.py b/swh/deposit/tests/loader/test_client.py --- a/swh/deposit/tests/loader/test_client.py +++ b/swh/deposit/tests/loader/test_client.py @@ -9,7 +9,6 @@ import unittest from nose.plugins.attrib import attr -from nose.tools import istest from swh.deposit.client import PrivateApiDepositClient from swh.deposit.config import DEPOSIT_STATUS_LOAD_SUCCESS @@ -52,8 +51,7 @@ super().setUp() shutil.rmtree(self.temporary_directory) - @istest - def archive_get(self): + def test_archive_get(self): """Reading archive should write data in temporary directory """ @@ -80,8 +78,7 @@ 'stream': True }) - @istest - def archive_get_with_authentication(self): + def test_archive_get_with_authentication(self): """Reading archive should write data in temporary directory """ @@ -113,8 +110,7 @@ 'auth': ('user', 'pass') }) - @istest - def archive_get_can_fail(self): + def test_archive_get_can_fail(self): """Reading archive can fail for some reasons """ @@ -142,8 +138,7 @@ class PrivateApiDepositClientReadMetadataTest(unittest.TestCase): - @istest - def metadata_get(self): + def test_metadata_get(self): """Reading archive should write data in temporary directory """ @@ -160,8 +155,7 @@ self.assertEquals(actual_metadata, expected_response) - @istest - def metadata_get_can_fail(self): + def test_metadata_get_can_fail(self): """Reading metadata can fail for some reasons """ @@ -187,8 +181,7 @@ class PrivateApiDepositClientStatusUpdateTest(unittest.TestCase): - @istest - def status_update(self): + def test_status_update(self): """Update status """ @@ -209,8 +202,7 @@ } }) - @istest - def status_update_with_no_revision_id(self): + def test_status_update_with_no_revision_id(self): """Reading metadata can fail for some reasons """ @@ -231,8 +223,7 @@ class PrivateApiDepositClientCheckTest(unittest.TestCase): - @istest - def check(self): + def test_check(self): """When check ok, this should return the deposit's status """ @@ -248,8 +239,7 @@ self.assertEquals(_client.kwargs, {}) self.assertEquals(r, 'something') - @istest - def check_fails(self): + def test_check_fails(self): """Checking deposit can fail for some reason """ diff --git a/swh/deposit/tests/loader/test_loader.py b/swh/deposit/tests/loader/test_loader.py --- a/swh/deposit/tests/loader/test_loader.py +++ b/swh/deposit/tests/loader/test_loader.py @@ -7,7 +7,6 @@ import unittest import shutil -from nose.tools import istest from nose.plugins.attrib import attr from rest_framework.test import APITestCase @@ -206,8 +205,7 @@ super().tearDown() shutil.rmtree(TEST_LOADER_CONFIG['extraction_dir']) - @istest - def inject_deposit_ready(self): + def test_inject_deposit_ready(self): """Load a deposit which is ready """ @@ -229,8 +227,7 @@ self.assertEquals(len(self.loader.state['release']), 0) self.assertEquals(len(self.loader.state['snapshot']), 1) - @istest - def inject_deposit_verify_metadata(self): + def test_inject_deposit_verify_metadata(self): """Load a deposit with metadata, test metadata integrity """ diff --git a/swh/deposit/tests/test_utils.py b/swh/deposit/tests/test_utils.py --- a/swh/deposit/tests/test_utils.py +++ b/swh/deposit/tests/test_utils.py @@ -5,7 +5,6 @@ import unittest -from nose.tools import istest from swh.deposit import utils @@ -14,8 +13,7 @@ """Utils library """ - @istest - def merge(self): + def test_merge(self): """Calling utils.merge on dicts should merge without losing information """ @@ -59,8 +57,7 @@ } self.assertEquals(actual_merge, expected_merge) - @istest - def merge_2(self): + def test_merge_2(self): d0 = { 'license': 'gpl2', 'runtime': { @@ -86,8 +83,7 @@ actual = utils.merge(d0, d1) self.assertEqual(actual, expected) - @istest - def merge_edge_cases(self): + def test_merge_edge_cases(self): input_dict = { 'license': ['gpl2', 'gpl3'], 'runtime': [ @@ -105,8 +101,7 @@ actual = utils.merge(input_dict, input_dict, input_dict) self.assertEqual(input_dict, input_dict) - @istest - def merge_one_dict(self): + def test_merge_one_dict(self): """Merge one dict should result in the same dict value """ @@ -114,8 +109,7 @@ actual = utils.merge(input_and_expected) self.assertEqual(actual, input_and_expected) - @istest - def merge_raise(self): + def test_merge_raise(self): """Calling utils.merge with any no dict argument should raise """