-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nginx content recursive proxy; simplify storage emulation with update
- Loading branch information
Showing
19 changed files
with
149 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,47 +18,9 @@ | |
|
||
from . import testdata | ||
from contentcuration.models import User | ||
from contentcuration.utils import minio_utils | ||
|
||
|
||
class BucketTestClassMixin(object): | ||
@classmethod | ||
def create_bucket(cls): | ||
minio_utils.ensure_storage_bucket_public(will_sleep=False) | ||
|
||
@classmethod | ||
def delete_bucket(cls): | ||
minio_utils.ensure_bucket_deleted() | ||
|
||
|
||
class BucketTestMixin: | ||
""" | ||
Handles bucket setup and tear down for test classes. If you want your entire TestCase to share the same bucket, | ||
call create_bucket in setUpClass and then set persist_bucket to True, then make sure you call self.delete_bucket() | ||
in tearDownClass. | ||
""" | ||
|
||
persist_bucket = False | ||
|
||
@classmethod | ||
def create_bucket(cls): | ||
minio_utils.ensure_storage_bucket_public(will_sleep=False) | ||
|
||
@classmethod | ||
def delete_bucket(cls): | ||
minio_utils.ensure_bucket_deleted() | ||
|
||
def setUp(self): | ||
raise Exception("Called?") | ||
if not self.persist_bucket: | ||
self.create_bucket() | ||
|
||
def tearDown(self): | ||
if not self.persist_bucket: | ||
self.delete_bucket() | ||
|
||
|
||
class StudioTestCase(TestCase, BucketTestMixin): | ||
class StudioTestCase(TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super(StudioTestCase, cls).setUpClass() | ||
|
@@ -67,22 +29,12 @@ def setUpClass(cls): | |
"big_shot", "[email protected]", "password" | ||
) | ||
|
||
def setUp(self): | ||
if not self.persist_bucket: | ||
self.create_bucket() | ||
|
||
def setUpBase(self): | ||
if not self.persist_bucket: | ||
self.create_bucket() | ||
self.channel = testdata.channel() | ||
self.user = testdata.user() | ||
self.channel.editors.add(self.user) | ||
self.channel.main_tree.refresh_from_db() | ||
|
||
def tearDown(self): | ||
if not self.persist_bucket: | ||
self.delete_bucket() | ||
|
||
def admin_client(self): | ||
client = APIClient() | ||
client.force_authenticate(self.admin_user) | ||
|
@@ -115,20 +67,12 @@ def get(self, url, data=None, follow=False, secure=False): | |
) | ||
|
||
|
||
class StudioAPITestCase(APITestCase, BucketTestMixin): | ||
class StudioAPITestCase(APITestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super(StudioAPITestCase, cls).setUpClass() | ||
call_command("loadconstants") | ||
|
||
def setUp(self): | ||
if not self.persist_bucket: | ||
self.create_bucket() | ||
|
||
def tearDown(self): | ||
if not self.persist_bucket: | ||
self.delete_bucket() | ||
|
||
def sign_in(self, user=None): | ||
if not user: | ||
user = self.user | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This directory contains nginx configuration files that are included in the main configuration file, via the `include` directive. This entire directory is copied to `/etc/nginx/includes` in the image. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# location {} settings for /content proxy | ||
# used by files in this directory, via `include` directive | ||
|
||
limit_except GET HEAD OPTIONS { | ||
deny all; | ||
} | ||
|
||
proxy_http_version 1.1; | ||
proxy_set_header Host $proxy_host; | ||
proxy_set_header Accept-Encoding Identity; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_redirect off; | ||
proxy_buffering off; | ||
proxy_cache off; | ||
proxy_read_timeout 100s; | ||
proxy_ssl_server_name on; | ||
|
||
gzip off; |
Oops, something went wrong.