Renamed some test_xxx files to common_test_xxx.py
Those files contain stuff for tests, but don't contain tests themselves.
This commit is contained in:
parent
adb4f5b39e
commit
d7ee2121d9
@ -9,7 +9,7 @@ import pymongo.collection
|
|||||||
from flask.testing import FlaskClient
|
from flask.testing import FlaskClient
|
||||||
import httpretty
|
import httpretty
|
||||||
|
|
||||||
from test_data import EXAMPLE_PROJECT, EXAMPLE_FILE
|
from common_test_data import EXAMPLE_PROJECT, EXAMPLE_FILE
|
||||||
|
|
||||||
BLENDER_ID_ENDPOINT = 'http://127.0.0.1:8001' # nonexistant server, no trailing slash!
|
BLENDER_ID_ENDPOINT = 'http://127.0.0.1:8001' # nonexistant server, no trailing slash!
|
||||||
MY_PATH = os.path.dirname(os.path.abspath(__file__))
|
MY_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||||
@ -24,7 +24,7 @@ logging.basicConfig(
|
|||||||
|
|
||||||
class AbstractPillarTest(TestMinimal):
|
class AbstractPillarTest(TestMinimal):
|
||||||
def setUp(self, **kwargs):
|
def setUp(self, **kwargs):
|
||||||
settings_file = os.path.join(MY_PATH, 'test_settings.py')
|
settings_file = os.path.join(MY_PATH, 'common_test_settings.py')
|
||||||
kwargs['settings_file'] = settings_file
|
kwargs['settings_file'] = settings_file
|
||||||
os.environ['EVE_SETTINGS'] = settings_file
|
os.environ['EVE_SETTINGS'] = settings_file
|
||||||
super(AbstractPillarTest, self).setUp(**kwargs)
|
super(AbstractPillarTest, self).setUp(**kwargs)
|
||||||
@ -46,7 +46,7 @@ class AbstractPillarTest(TestMinimal):
|
|||||||
# but also un-import the application.
|
# but also un-import the application.
|
||||||
del sys.modules['application']
|
del sys.modules['application']
|
||||||
|
|
||||||
def _ensure_file_exists(self, file_overrides=None):
|
def ensure_file_exists(self, file_overrides=None):
|
||||||
with self.app.test_request_context():
|
with self.app.test_request_context():
|
||||||
files_collection = self.app.data.driver.db['files']
|
files_collection = self.app.data.driver.db['files']
|
||||||
projects_collection = self.app.data.driver.db['projects']
|
projects_collection = self.app.data.driver.db['projects']
|
@ -239,7 +239,7 @@ EXAMPLE_PROJECT = {
|
|||||||
u'is_tileable': {u'type': u'boolean'},
|
u'is_tileable': {u'type': u'boolean'},
|
||||||
u'order': {u'type': u'integer'},
|
u'order': {u'type': u'integer'},
|
||||||
u'resolution': {u'type': u'string'},
|
u'resolution': {u'type': u'string'},
|
||||||
u'status': {u'allowed': [u'published',
|
u'stat_ensure_file_existsus': {u'allowed': [u'published',
|
||||||
u'pending',
|
u'pending',
|
||||||
u'processing',
|
u'processing',
|
||||||
u'deleted'],
|
u'deleted'],
|
@ -1,7 +1,7 @@
|
|||||||
import base64
|
import base64
|
||||||
import httpretty
|
import httpretty
|
||||||
|
|
||||||
from common_test_stuff import AbstractPillarTest, TEST_EMAIL_USER, TEST_EMAIL_ADDRESS
|
from common_test_class import AbstractPillarTest, TEST_EMAIL_USER, TEST_EMAIL_ADDRESS
|
||||||
|
|
||||||
|
|
||||||
def make_header(username, password=''):
|
def make_header(username, password=''):
|
||||||
|
@ -4,7 +4,7 @@ import bson.tz_util
|
|||||||
import datetime
|
import datetime
|
||||||
from eve import RFC1123_DATE_FORMAT
|
from eve import RFC1123_DATE_FORMAT
|
||||||
|
|
||||||
from common_test_stuff import AbstractPillarTest
|
from common_test_class import AbstractPillarTest
|
||||||
|
|
||||||
|
|
||||||
class FileCachingTest(AbstractPillarTest):
|
class FileCachingTest(AbstractPillarTest):
|
||||||
@ -15,7 +15,7 @@ class FileCachingTest(AbstractPillarTest):
|
|||||||
self.assertEqual(404, resp.status_code)
|
self.assertEqual(404, resp.status_code)
|
||||||
|
|
||||||
def test_existing_file(self):
|
def test_existing_file(self):
|
||||||
file_id, _ = self._ensure_file_exists()
|
file_id, _ = self.ensure_file_exists()
|
||||||
|
|
||||||
resp = self.client.get('/files/%s' % file_id)
|
resp = self.client.get('/files/%s' % file_id)
|
||||||
self.assertEqual(200, resp.status_code)
|
self.assertEqual(200, resp.status_code)
|
||||||
@ -24,7 +24,7 @@ class FileCachingTest(AbstractPillarTest):
|
|||||||
with self.app.test_request_context():
|
with self.app.test_request_context():
|
||||||
# Make sure the file link has not expired.
|
# Make sure the file link has not expired.
|
||||||
expires = datetime.datetime.now(tz=bson.tz_util.utc) + datetime.timedelta(minutes=1)
|
expires = datetime.datetime.now(tz=bson.tz_util.utc) + datetime.timedelta(minutes=1)
|
||||||
file_id, file_doc = self._ensure_file_exists(file_overrides={
|
file_id, file_doc = self.ensure_file_exists(file_overrides={
|
||||||
u'link_expires': expires
|
u'link_expires': expires
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ class FileCachingTest(AbstractPillarTest):
|
|||||||
self.assertEqual(304, resp.status_code)
|
self.assertEqual(304, resp.status_code)
|
||||||
|
|
||||||
def test_if_modified_200(self):
|
def test_if_modified_200(self):
|
||||||
file_id, file_doc = self._ensure_file_exists()
|
file_id, file_doc = self.ensure_file_exists()
|
||||||
|
|
||||||
delta = datetime.timedelta(days=-1)
|
delta = datetime.timedelta(days=-1)
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ class FileCachingTest(AbstractPillarTest):
|
|||||||
with self.app.test_request_context():
|
with self.app.test_request_context():
|
||||||
# Make sure the file link has expired.
|
# Make sure the file link has expired.
|
||||||
expires = datetime.datetime.now(tz=bson.tz_util.utc) - datetime.timedelta(seconds=1)
|
expires = datetime.datetime.now(tz=bson.tz_util.utc) - datetime.timedelta(seconds=1)
|
||||||
file_id, file_doc = self._ensure_file_exists(file_overrides={
|
file_id, file_doc = self.ensure_file_exists(file_overrides={
|
||||||
u'link_expires': expires
|
u'link_expires': expires
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user