- {% block form-intro %}
- {% blocktrans %}
-
The service {{ oauth2_client }} want to get one of your documents.
- {% endblocktrans %}
- {% endblock %}
- {% block form %}
-
- {% endblock %}
-
-{% endblock %}
diff --git a/fargo/templates/fargo/oauth2/confirm.html b/fargo/templates/fargo/oauth2/confirm.html
deleted file mode 100644
index 52a7576..0000000
--- a/fargo/templates/fargo/oauth2/confirm.html
+++ /dev/null
@@ -1,33 +0,0 @@
-{% extends "fargo/base.html" %}
-{% load i18n %}
-
-{% block content %}
-
- {% if oauth2_document %}
- {% block form-intro %}
-
- {% blocktrans %}
-The service {{ oauth2_client }} want to add the document "{{ filename }}" to your portfolio.
- {% endblocktrans %}
-
- {% if thumbnail %}
{% endif %}
- {% endblock %}
- {% endif %}
- {% if error_message %}
- {% block error-message %}
-
{% trans error_message %}
- {% endblock %}
- {% endif %}
- {% block form %}
-
- {% endblock %}
-
-{% endblock %}
diff --git a/fargo/urls.py b/fargo/urls.py
index 4396c9e..60bbd89 100644
--- a/fargo/urls.py
+++ b/fargo/urls.py
@@ -55,7 +55,6 @@ urlpatterns = [
url(r'^api/documents/push/$', push_document, name='fargo-api-push-document'),
url(r'^api/documents/recently-added/$', recent_documents),
url(r'^api/', include(router.urls)),
- url(r'^api/', include('fargo.oauth2.urls')),
]
if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:
diff --git a/tests/conftest.py b/tests/conftest.py
index 4c05c5b..d079619 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -100,8 +100,8 @@ def admin_user(db):
@pytest.fixture
def document():
- with open('tests/test_oauth2.txt', 'rb') as f:
- content = ContentFile(f.read(), 'test_oauth2.txt')
+ with open('tests/test_file.txt', 'rb') as f:
+ content = ContentFile(f.read(), 'test_file.txt')
return Document.objects.get_by_file(content)
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 9c8d187..dad16bf 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -21,46 +21,30 @@ from django.core.files.base import ContentFile
from django.core.management import call_command
from fargo.fargo.models import Document, UserDocument
-from fargo.oauth2.models import OAuth2Client, OAuth2TempFile
def test_cleanup(freezer, john_doe):
start = freezer()
- client = OAuth2Client.objects.create(client_name='c', redirect_uris='')
-
foo = Document.objects.create(content=ContentFile(b'foo', name='foo.txt'))
- bar = Document.objects.create(content=ContentFile(b'bar', name='bar.txt'))
UserDocument.objects.create(user=john_doe, document=foo, filename='foo.txt', title='', description='')
- OAuth2TempFile.objects.create(document=bar, client=client, filename='bar.txt')
call_command('fargo-cleanup')
assert UserDocument.objects.all().count()
- assert OAuth2TempFile.objects.all().count()
- assert Document.objects.all().count() == 2
+ assert Document.objects.all().count() == 1
User.objects.all().delete()
assert not UserDocument.objects.all().count()
- assert Document.objects.all().count() == 2
+ assert Document.objects.all().count() == 1
call_command('fargo-cleanup')
- assert Document.objects.all().count() == 2
-
- freezer.move_to(start + datetime.timedelta(seconds=120))
- call_command('fargo-cleanup')
-
assert Document.objects.all().count() == 1
freezer.move_to(start + datetime.timedelta(days=3))
call_command('fargo-cleanup')
- assert not OAuth2TempFile.objects.count()
- assert Document.objects.count()
-
- call_command('fargo-cleanup')
-
assert not Document.objects.count()
diff --git a/tests/test_file.txt b/tests/test_file.txt
new file mode 100644
index 0000000..888df51
--- /dev/null
+++ b/tests/test_file.txt
@@ -0,0 +1,6 @@
+Lorem ipsum dolor sit amet, atqui animal constituto sit no, pri liber mandamus
+ea, usu no duis etiam copiosae. Ius liber scripserit at, nam nisl nonumes ne.
+Ut vidit clita possim eum, eos eu melius perfecto. Ne ius intellegam
+reformidans, pri repudiare conceptam definitiones cu, duo tota bonorum no.
+Lorem omnesque principes in ius, facilis erroribus cu usu. Eum liber homero
+qualisque id, cu pri illum consetetur.
diff --git a/tests/test_oauth2.py b/tests/test_oauth2.py
deleted file mode 100644
index 9151bcc..0000000
--- a/tests/test_oauth2.py
+++ /dev/null
@@ -1,265 +0,0 @@
-# fargo - document box
-# Copyright (C) 2016-2019 Entr'ouvert
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License as published
-# by the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see