|
1 | 1 | #!/usr/bin/env python3
|
2 | 2 | """Views tests for the OSF."""
|
3 |
| -from unittest.mock import MagicMock, ANY |
4 |
| -from urllib import parse |
5 |
| - |
6 |
| -import datetime as dt |
7 |
| -import time |
8 |
| -import unittest |
9 | 3 | from hashlib import md5
|
10 |
| -from http.cookies import SimpleCookie |
11 | 4 | from unittest import mock
|
12 |
| -from urllib.parse import quote_plus |
13 |
| - |
14 | 5 | import pytest
|
15 |
| -from django.core.exceptions import ValidationError |
16 |
| -from django.utils import timezone |
17 |
| -from flask import request, g |
18 |
| -from lxml import html |
19 |
| -from pytest import approx |
20 | 6 | from rest_framework import status as http_status
|
21 | 7 |
|
22 | 8 | from addons.github.tests.factories import GitHubAccountFactory
|
23 |
| -from addons.osfstorage import settings as osfstorage_settings |
24 |
| -from addons.wiki.models import WikiPage |
25 |
| -from framework import auth |
26 |
| -from framework.auth import Auth, authenticate, cas, core |
27 |
| -from framework.auth.campaigns import ( |
28 |
| - get_campaigns, |
29 |
| - is_institution_login, |
30 |
| - is_native_login, |
31 |
| - is_proxy_login, |
32 |
| - campaign_url_for |
33 |
| -) |
34 |
| -from framework.auth.exceptions import InvalidTokenError |
35 |
| -from framework.auth.utils import impute_names_model, ensure_external_identity_uniqueness |
36 |
| -from framework.auth.views import login_and_register_handler |
37 | 9 | from framework.celery_tasks import handlers
|
38 |
| -from framework.exceptions import HTTPError, TemplateHTTPError |
39 |
| -from framework.flask import redirect |
40 |
| -from framework.transactions.handlers import no_auto_transaction |
41 | 10 | from osf.external.spam import tasks as spam_tasks
|
42 | 11 | from osf.models import (
|
43 |
| - Comment, |
44 |
| - AbstractNode, |
45 |
| - OSFUser, |
46 |
| - Tag, |
47 |
| - SpamStatus, |
48 |
| - NodeRelation, |
49 | 12 | NotableDomain
|
50 | 13 | )
|
51 |
| -from osf.utils import permissions |
52 | 14 | from osf_tests.factories import (
|
53 | 15 | fake_email,
|
54 | 16 | ApiOAuth2ApplicationFactory,
|
55 | 17 | ApiOAuth2PersonalTokenFactory,
|
56 | 18 | AuthUserFactory,
|
57 |
| - CollectionFactory, |
58 |
| - CommentFactory, |
59 |
| - NodeFactory, |
60 |
| - OSFGroupFactory, |
61 |
| - PreprintFactory, |
62 |
| - PreprintProviderFactory, |
63 |
| - PrivateLinkFactory, |
64 |
| - ProjectFactory, |
65 |
| - ProjectWithAddonFactory, |
66 |
| - RegistrationProviderFactory, |
67 |
| - UserFactory, |
68 |
| - UnconfirmedUserFactory, |
69 |
| - UnregUserFactory, |
70 | 19 | RegionFactory,
|
71 |
| - DraftRegistrationFactory, |
72 | 20 | )
|
73 | 21 | from tests.base import (
|
74 |
| - assert_is_redirect, |
75 |
| - capture_signals, |
76 | 22 | fake,
|
77 |
| - get_default_metaschema, |
78 | 23 | OsfTestCase,
|
79 |
| - assert_datetime_equal, |
80 |
| - test_app |
81 |
| -) |
82 |
| -from tests.test_cas_authentication import generate_external_user_with_resp |
83 |
| -from tests.utils import run_celery_tasks |
84 |
| -from website import mailchimp_utils, mails, settings, language |
85 |
| -from website.profile.utils import add_contributor_json, serialize_unregistered |
86 |
| -from website.profile.views import update_osf_help_mails_subscription |
87 |
| -from website.project.decorators import check_can_access |
88 |
| -from website.project.model import has_anonymous_link |
89 |
| -from website.project.signals import contributor_added |
90 |
| -from website.project.views.contributor import ( |
91 |
| - deserialize_contributors, |
92 |
| - notify_added_contributor, |
93 |
| - send_claim_email, |
94 |
| - send_claim_registered_email, |
95 | 24 | )
|
96 |
| -from website.project.views.node import _should_show_wiki_widget, abbrev_authors |
| 25 | +from website import mailchimp_utils |
97 | 26 | from website.settings import MAILCHIMP_GENERAL_LIST
|
98 | 27 | from website.util import api_url_for, web_url_for
|
99 |
| -from website.util import rubeus |
100 |
| -from website.util.metrics import OsfSourceTags, OsfClaimedTags, provider_source_tag, provider_claimed_tag |
101 | 28 |
|
102 | 29 |
|
103 | 30 | @pytest.mark.enable_enqueue_task
|
|
0 commit comments