From e5cd693e7b76fe497d10f4bcd447c3a319466efc Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 13 Nov 2014 16:07:25 +0000 Subject: [PATCH] Remove test cruft --- tests/accounts/__init__.py | 0 tests/accounts/models.py | 8 -------- tests/accounts/serializers.py | 11 ----------- tests/conftest.py | 3 --- tests/put_as_create_workspace.txt | 33 ------------------------------- tests/records/__init__.py | 0 tests/records/models.py | 6 ------ tests/settings.py | 3 --- tests/test_serializer_import.py | 19 ------------------ tests/users/__init__.py | 0 tests/users/models.py | 6 ------ tests/users/serializers.py | 8 -------- 12 files changed, 97 deletions(-) delete mode 100644 tests/accounts/__init__.py delete mode 100644 tests/accounts/models.py delete mode 100644 tests/accounts/serializers.py delete mode 100644 tests/put_as_create_workspace.txt delete mode 100644 tests/records/__init__.py delete mode 100644 tests/records/models.py delete mode 100644 tests/test_serializer_import.py delete mode 100644 tests/users/__init__.py delete mode 100644 tests/users/models.py delete mode 100644 tests/users/serializers.py diff --git a/tests/accounts/__init__.py b/tests/accounts/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/accounts/models.py b/tests/accounts/models.py deleted file mode 100644 index 3bf4a0c3c..000000000 --- a/tests/accounts/models.py +++ /dev/null @@ -1,8 +0,0 @@ -from django.db import models - -from tests.users.models import User - - -class Account(models.Model): - owner = models.ForeignKey(User, related_name='accounts_owned') - admins = models.ManyToManyField(User, blank=True, null=True, related_name='accounts_administered') diff --git a/tests/accounts/serializers.py b/tests/accounts/serializers.py deleted file mode 100644 index 57a91b92c..000000000 --- a/tests/accounts/serializers.py +++ /dev/null @@ -1,11 +0,0 @@ -from rest_framework import serializers - -from tests.accounts.models import Account -from tests.users.serializers import UserSerializer - - -class AccountSerializer(serializers.ModelSerializer): - admins = UserSerializer(many=True) - - class Meta: - model = Account diff --git a/tests/conftest.py b/tests/conftest.py index 4b33e19c1..31142eaf9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,9 +33,6 @@ def pytest_configure(): 'rest_framework', 'rest_framework.authtoken', 'tests', - 'tests.accounts', - 'tests.records', - 'tests.users', ), PASSWORD_HASHERS=( 'django.contrib.auth.hashers.SHA1PasswordHasher', diff --git a/tests/put_as_create_workspace.txt b/tests/put_as_create_workspace.txt deleted file mode 100644 index 6bc5218eb..000000000 --- a/tests/put_as_create_workspace.txt +++ /dev/null @@ -1,33 +0,0 @@ -# From test_validation... - -class TestPreSaveValidationExclusions(TestCase): - def test_pre_save_validation_exclusions(self): - """ - Somewhat weird test case to ensure that we don't perform model - validation on read only fields. - """ - obj = ValidationModel.objects.create(blank_validated_field='') - request = factory.put('/', {}, format='json') - view = UpdateValidationModel().as_view() - response = view(request, pk=obj.pk).render() - self.assertEqual(response.status_code, status.HTTP_200_OK) - - -# From test_permissions... - -class ModelPermissionsIntegrationTests(TestCase): - def setUp(...): - ... - - def test_has_put_as_create_permissions(self): - # User only has update permissions - should be able to update an entity. - request = factory.put('/1', {'text': 'foobar'}, format='json', - HTTP_AUTHORIZATION=self.updateonly_credentials) - response = instance_view(request, pk='1') - self.assertEqual(response.status_code, status.HTTP_200_OK) - - # But if PUTing to a new entity, permission should be denied. - request = factory.put('/2', {'text': 'foobar'}, format='json', - HTTP_AUTHORIZATION=self.updateonly_credentials) - response = instance_view(request, pk='2') - self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) diff --git a/tests/records/__init__.py b/tests/records/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/records/models.py b/tests/records/models.py deleted file mode 100644 index 769548074..000000000 --- a/tests/records/models.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.db import models - - -class Record(models.Model): - account = models.ForeignKey('accounts.Account', blank=True, null=True) - owner = models.ForeignKey('users.User', blank=True, null=True) diff --git a/tests/settings.py b/tests/settings.py index 91c9ed09e..b6736199c 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -96,9 +96,6 @@ INSTALLED_APPS = ( 'rest_framework', 'rest_framework.authtoken', 'tests', - 'tests.accounts', - 'tests.records', - 'tests.users', ) # OAuth is optional and won't work if there is no oauth_provider & oauth2 diff --git a/tests/test_serializer_import.py b/tests/test_serializer_import.py deleted file mode 100644 index d029c3c55..000000000 --- a/tests/test_serializer_import.py +++ /dev/null @@ -1,19 +0,0 @@ -# from django.test import TestCase - -# from rest_framework import serializers -# from tests.accounts.serializers import AccountSerializer - - -# class ImportingModelSerializerTests(TestCase): -# """ -# In some situations like, GH #1225, it is possible, especially in -# testing, to import a serializer who's related models have not yet -# been resolved by Django. `AccountSerializer` is an example of such -# a serializer (imported at the top of this file). -# """ -# def test_import_model_serializer(self): -# """ -# The serializer at the top of this file should have been -# imported successfully, and we should be able to instantiate it. -# """ -# self.assertIsInstance(AccountSerializer(), serializers.ModelSerializer) diff --git a/tests/users/__init__.py b/tests/users/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/users/models.py b/tests/users/models.py deleted file mode 100644 index 128bac90b..000000000 --- a/tests/users/models.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.db import models - - -class User(models.Model): - account = models.ForeignKey('accounts.Account', blank=True, null=True, related_name='users') - active_record = models.ForeignKey('records.Record', blank=True, null=True) diff --git a/tests/users/serializers.py b/tests/users/serializers.py deleted file mode 100644 index 4893ddb34..000000000 --- a/tests/users/serializers.py +++ /dev/null @@ -1,8 +0,0 @@ -from rest_framework import serializers - -from tests.users.models import User - - -class UserSerializer(serializers.ModelSerializer): - class Meta: - model = User