Skip to content

Commit

Permalink
Move the tests folder (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecRosenbaum authored Aug 20, 2020
1 parent 28b5adb commit 9e41c65
Show file tree
Hide file tree
Showing 168 changed files with 140 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
docker-compose run nylas bash -ec '
pip install -e . \
&& bin/wait-for-it.sh mysql:3306 \
&& NYLAS_ENV=test py.test inbox/test/
&& NYLAS_ENV=test py.test tests/
'
workflows:
Expand Down
2 changes: 0 additions & 2 deletions inbox/test/scheduling/conftest.py

This file was deleted.

4 changes: 0 additions & 4 deletions inbox/test/search/conftest.py

This file was deleted.

7 changes: 6 additions & 1 deletion inbox/util/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ def files(db):
data = []
for filename in filenames:
path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "test", "data", filename
os.path.dirname(os.path.abspath(__file__)),
"..",
"..",
"tests",
"data",
filename,
).encode("utf-8")
data.append((filename, path))
return data
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 2 additions & 7 deletions inbox/test/api/test_account.py → tests/api/test_account.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# flake8: noqa: F811
from inbox.test.api.base import api_client, new_api_client
from inbox.test.util.base import (
add_fake_yahoo_account,
db,
generic_account,
gmail_account,
)
from tests.api.base import api_client, new_api_client
from tests.util.base import add_fake_yahoo_account, db, generic_account, gmail_account

__all__ = ["db", "api_client", "generic_account", "gmail_account"]

Expand Down
4 changes: 2 additions & 2 deletions inbox/test/api/test_auth.py → tests/api/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json
from base64 import b64encode

from inbox.test.api.base import new_api_client # noqa
from inbox.test.util.base import db, generic_account # noqa
from tests.api.base import new_api_client # noqa
from tests.util.base import db, generic_account # noqa


def test_no_auth(db, generic_account): # noqa
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from inbox.models import Calendar
from inbox.test.api.base import api_client
from inbox.test.util.base import add_fake_event, db, default_namespace

from tests.api.base import api_client
from tests.util.base import add_fake_event, db, default_namespace

__all__ = ["api_client", "db", "default_namespace"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from inbox.models import Contact
from inbox.test.api.base import api_client
from inbox.test.util.base import contact_sync, contacts_provider

from tests.api.base import api_client
from tests.util.base import contact_sync, contacts_provider

__all__ = ["contacts_provider", "contact_sync", "api_client"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from sqlalchemy.orm.exc import NoResultFound

from inbox.models import DataProcessingCache
from inbox.test.api.base import api_client
from inbox.test.util.base import add_fake_message, add_fake_thread, default_namespace

from tests.api.base import api_client
from tests.util.base import add_fake_message, add_fake_thread, default_namespace

__all__ = ["api_client", "default_namespace"]

Expand Down
4 changes: 2 additions & 2 deletions inbox/test/api/test_drafts.py → tests/api/test_drafts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import pytest
from freezegun import freeze_time

from inbox.test.api.base import api_client
from inbox.test.util.base import add_fake_message, add_fake_thread
from tests.api.base import api_client
from tests.util.base import add_fake_message, add_fake_thread

__all__ = ["api_client"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import pytest

from inbox.test.api.base import api_client
from inbox.test.util.base import calendar
from tests.api.base import api_client
from tests.util.base import calendar

__all__ = ["calendar", "api_client"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import arrow
import pytest

from inbox.test.api.base import api_client
from tests.api.base import api_client

__all__ = ["api_client"]

Expand Down
5 changes: 3 additions & 2 deletions inbox/test/api/test_events.py → tests/api/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from inbox.api.ns_api import API_VERSIONS
from inbox.models import Calendar, Event
from inbox.sqlalchemy_ext.util import generate_public_id
from inbox.test.api.base import api_client
from inbox.test.util.base import add_fake_event, calendar, db

from tests.api.base import api_client
from tests.util.base import add_fake_event, calendar, db

__all__ = ["api_client", "calendar", "db"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import pytest

from inbox.models import Calendar, Event
from inbox.test.api.base import api_client
from inbox.test.util.base import message

from tests.api.base import api_client
from tests.util.base import message

__all__ = ["api_client"]

Expand Down
3 changes: 2 additions & 1 deletion inbox/test/api/test_files.py → tests/api/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import pytest

from inbox.models import Block, Part
from inbox.test.api.base import api_client
from inbox.util.testutils import FILENAMES

from tests.api.base import api_client

__all__ = ["api_client"]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
from sqlalchemy import desc

from inbox.models import Block, Category, Message, Namespace, Thread
from inbox.test.api.base import api_client
from inbox.test.util.base import add_fake_message, add_fake_thread, test_client
from inbox.util.misc import dt_to_timestamp

from tests.api.base import api_client
from tests.util.base import add_fake_message, add_fake_thread, test_client

__all__ = ["api_client", "test_client"]


Expand Down
5 changes: 3 additions & 2 deletions inbox/test/api/test_folders.py → tests/api/test_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import gevent
import mock

from inbox.test.api.base import imap_api_client
from inbox.test.util.base import add_fake_category, add_fake_folder
from inbox.util.testutils import mock_imapclient # noqa

from tests.api.base import imap_api_client
from tests.util.base import add_fake_category, add_fake_folder


# Check that folders of the form INBOX.A.B get converted by the API
# to A/B.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

from inbox.api.ns_api import API_VERSIONS
from inbox.models.category import EPOCH, Category
from inbox.test.api.base import api_client, new_api_client
from inbox.test.util.base import (

from tests.api.base import api_client, new_api_client
from tests.util.base import (
add_fake_message,
add_fake_thread,
generic_account,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import pytest
import requests

from inbox.test.api.base import api_client
from inbox.test.util.base import db
from tests.api.base import api_client
from tests.util.base import db

__all__ = ["api_client", "db"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import pytest

from inbox.api.ns_api import API_VERSIONS
from inbox.test.api.base import api_client, new_api_client
from inbox.test.util.base import (
from inbox.util.blockstore import get_from_blockstore

from tests.api.base import api_client, new_api_client
from tests.util.base import (
add_fake_message,
add_fake_thread,
default_namespace,
Expand All @@ -16,7 +18,6 @@
new_message_from_synced,
thread,
)
from inbox.util.blockstore import get_from_blockstore

__all__ = [
"api_client",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import pytest

from inbox.ignition import redis_txn
from inbox.test.util.base import add_fake_message

from tests.util.base import add_fake_message


class TestGlobalDeltas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
from inbox.search.backends.gmail import GmailSearchClient
from inbox.search.backends.imap import IMAPSearchClient
from inbox.search.base import get_search_client
from inbox.test.api.base import api_client, imap_api_client
from inbox.test.util.base import (

from tests.api.base import api_client, imap_api_client
from tests.util.base import (
add_fake_folder,
add_fake_imapuid,
add_fake_message,
Expand Down
5 changes: 3 additions & 2 deletions inbox/test/api/test_sending.py → tests/api/test_sending.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
from inbox.basicauth import OAuthError
from inbox.models import Event, Message
from inbox.sendmail.smtp.postel import _substitute_bcc
from inbox.test.api.base import api_client
from inbox.test.util.base import imported_event, message, thread

from tests.api.base import api_client
from tests.util.base import imported_event, message, thread

__all__ = ["thread", "message", "api_client", "imported_event"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import pytest
from gevent import Greenlet

from inbox.test.api.base import api_client
from inbox.test.util.base import add_fake_message
from inbox.util.url import url_concat

from tests.api.base import api_client
from tests.util.base import add_fake_message

GEVENT_EPSILON = 0.5 # Greenlet switching time. VMs on Macs suck :()
LONGPOLL_EPSILON = 2 + GEVENT_EPSILON # API implementation polls every second

Expand Down
5 changes: 3 additions & 2 deletions inbox/test/api/test_threads.py → tests/api/test_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import pytest

from inbox.api.ns_api import API_VERSIONS
from inbox.test.api.base import api_client
from inbox.test.util.base import add_fake_message, add_fake_thread, db, default_account

from tests.api.base import api_client
from tests.util.base import add_fake_message, add_fake_thread, db, default_account

__all__ = ["db", "api_client", "default_account"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

from inbox.api.validation import noop_event_update, valid_email
from inbox.models import Namespace
from inbox.test.api.base import api_client
from inbox.test.util.base import add_fake_event, calendar, db

from tests.api.base import api_client
from tests.util.base import add_fake_event, calendar, db

__all__ = ["api_client", "db", "calendar"]

Expand Down
4 changes: 2 additions & 2 deletions inbox/test/api/test_views.py → tests/api/test_views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# flake8: noqa: F811
import pytest

from inbox.test.api.base import api_client, new_api_client
from inbox.test.util.base import generic_account
from tests.api.base import api_client, new_api_client
from tests.util.base import generic_account

__all__ = ["api_client", "generic_account"]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion inbox/test/conftest.py → tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

gevent_openssl.monkey_patch()

from inbox.test.util.base import * # noqa
from inbox.util.testutils import files # noqa
from inbox.util.testutils import mock_dns_resolver # noqa
from inbox.util.testutils import mock_imapclient # noqa
from inbox.util.testutils import mock_smtp_get_connection # noqa
from inbox.util.testutils import uploaded_file_ids

from tests.util.base import * # noqa

from inbox.util.testutils import dump_dns_queries # noqa; noqa
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Sanity-check our logic for updating contact data from message addressees
during a sync."""
from inbox.models import Contact
from inbox.test.util.base import add_fake_message

from tests.util.base import add_fake_message


def test_update_contacts_from_message(db, default_namespace, thread):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pytest

from inbox.models import Contact
from inbox.test.util.base import ContactsProviderStub, contact_sync, contacts_provider

from tests.util.base import ContactsProviderStub, contact_sync, contacts_provider

__all__ = ["contact_sync", "contacts_provider"]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from inbox.events.ical import events_from_ics, import_attached_events
from inbox.events.util import MalformedEventError
from inbox.models.event import Event, RecurringEvent
from inbox.test.util.base import (

from tests.util.base import (
absolute_path,
add_fake_calendar,
add_fake_msg_with_calendar_part,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# flake8: noqa: F401,F811
from inbox.test.util.base import event
from tests.util.base import event


def test_invite_generation(event, default_account):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from inbox.test.util.base import add_fake_gmail_account, add_generic_imap_account
from tests.util.base import add_fake_gmail_account, add_generic_imap_account


def add_fake_imap_account(db_session, provider, email_address, password):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from inbox.models import Folder, Label
from inbox.models.category import sanitize_name
from inbox.models.constants import MAX_INDEXABLE_LENGTH
from inbox.test.util.base import (

from tests.util.base import (
add_fake_folder,
add_fake_label,
db,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9e41c65

Please sign in to comment.