WIP: 2021 02 24 dockerize (#18)
* Use cache for most fields and admin form for m2m files * MR comments/clean up * Cache should obey exclude and fields * Some more tests and docs * Only use cache for image files * Even more tests and handle save as new * fix test * More tests * minor refactor * Improve test coverage * Adding tests for fieldsets * Added cache timeout * Added another test for an edge case * Fix issue with ManagementForm tampered with * Update cache to only set when form is_multipart * Even more testing changes * Dockerize * Setting up tests in docker * Update github actions * Got first integration test to work * Refactor a bit * Fix github action yml * Use docker-compose up -d in github actions * combine coveralls * Updated readme * Clean up code * Remove dup code from rebase Co-authored-by: Thu Trang Pham <thu@joinmodernhealth.com>
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
</div>
|
||||
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}
|
||||
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %}
|
||||
{% if form.is_multipart %}<input type="hidden" name=CONFIRMATION_RECEIVED value="True">{% endif %}
|
||||
{% if form.is_multipart %}<input type="hidden" name="_confirmation_received" value="True">{% endif %}
|
||||
<div class="submit-row">
|
||||
<input type="submit" value="{% trans 'Yes, I’m sure' %}" name="{{ submit_name }}">
|
||||
<p class="deletelink-box">
|
||||
|
||||
@@ -2,7 +2,6 @@ from django.core.cache import cache
|
||||
from django.test import TestCase, RequestFactory
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
class AdminConfirmTestCase(TestCase):
|
||||
"""
|
||||
Helper TestCase class and common associated assertions
|
||||
@@ -43,7 +42,7 @@ class AdminConfirmTestCase(TestCase):
|
||||
self.assertNotIn("_confirm_change", rendered_content)
|
||||
|
||||
confirmation_received_html = (
|
||||
'<input type="hidden" name=CONFIRMATION_RECEIVED value="True">'
|
||||
'<input type="hidden" name="_confirmation_received" value="True">'
|
||||
)
|
||||
|
||||
if multipart_form:
|
||||
@@ -56,3 +55,31 @@ class AdminConfirmTestCase(TestCase):
|
||||
for k, v in fields.items():
|
||||
self.assertIn(f'name="{k}"', rendered_content)
|
||||
self.assertIn(f'value="{v}"', rendered_content)
|
||||
|
||||
def _assertFormsetsFormHtml(self, rendered_content, inlines):
|
||||
for inline in inlines:
|
||||
for field in inline.fields:
|
||||
self.assertIn("apple", rendered_content)
|
||||
|
||||
|
||||
|
||||
import socket
|
||||
from django.test import LiveServerTestCase
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||
|
||||
|
||||
class AdminConfirmIntegrationTestCase(LiveServerTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.host = socket.gethostbyname(socket.gethostname())
|
||||
cls.selenium = webdriver.Remote(
|
||||
command_executor="http://selenium:4444/wd/hub",
|
||||
desired_capabilities=DesiredCapabilities.FIREFOX,
|
||||
)
|
||||
super().setUpClass()
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.selenium.quit()
|
||||
super().tearDownClass()
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
from admin_confirm.tests.helpers import AdminConfirmIntegrationTestCase
|
||||
|
||||
|
||||
class SmokeTest(AdminConfirmIntegrationTestCase):
|
||||
def test_load_admin(self):
|
||||
self.selenium.get(self.live_server_url+'/admin/')
|
||||
self.assertIn('Django', self.selenium.title)
|
||||
@@ -6,7 +6,7 @@ from tests.market.admin import ShoppingMallAdmin
|
||||
from tests.market.models import GeneralManager, ShoppingMall, Town
|
||||
from tests.factories import ShopFactory
|
||||
|
||||
from admin_confirm.constants import CACHE_KEYS, CONFIRMATION_RECEIVED
|
||||
from admin_confirm.constants import CACHE_KEYS
|
||||
|
||||
|
||||
@mock.patch.object(ShoppingMallAdmin, "inlines", [])
|
||||
|
||||
Reference in New Issue
Block a user