Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Aug 12, 2018
1 parent 496c272 commit 01edc04
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 33 deletions.
16 changes: 10 additions & 6 deletions examples/simple/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@
DATABASES = {
'default': {
# Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'ENGINE': 'django.db.backends.sqlite3',
# Or path to database file if using sqlite3.
'NAME': PROJECT_DIR('../../db/example.db'),
# The following settings are not used with sqlite3:
'USER': '',
'PASSWORD': '',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'fobi',
'USER': 'postgres',
'PASSWORD': 'test',

# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': PROJECT_DIR('../../db/example.db'),
# 'USER': '',
# 'PASSWORD': '',

# Empty for localhost through domain sockets or '127.0.0.1' for
# localhost through TCP.
'HOST': '',
Expand Down
22 changes: 14 additions & 8 deletions src/fobi/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class BaseFobiBrowserBuldDynamicFormsTest(LiveServerTestCase):
Backed up by selenium. This test is based on the bootstrap3 theme.
"""

reset_sequences = True
cleans_up_after_itself = True

try:
LIVE_SERVER_URL = settings.LIVE_SERVER_URL
except Exception as e:
Expand All @@ -54,11 +56,13 @@ class BaseFobiBrowserBuldDynamicFormsTest(LiveServerTestCase):
def tearDown(self):
"""Tear down."""
super(BaseFobiBrowserBuldDynamicFormsTest, self).tearDown()
call_command('flush', verbosity=0, interactive=False,
reset_sequences=False,
allow_cascade=False,
call_command('flush',
verbosity=0,
interactive=False,
reset_sequences=True,
allow_cascade=True,
inhibit_post_migrate=False)
gc.collect()
# gc.collect()

@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -97,11 +101,13 @@ def tearDownClass(cls):
print(err)

super(BaseFobiBrowserBuldDynamicFormsTest, cls).tearDownClass()
call_command('flush', verbosity=0, interactive=False,
reset_sequences=False,
allow_cascade=False,
call_command('flush',
verbosity=0,
interactive=False,
reset_sequences=True,
allow_cascade=True,
inhibit_post_migrate=False)
gc.collect()
# gc.collect()

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
24 changes: 5 additions & 19 deletions src/fobi/tests/test_browser_build_dynamic_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from . import constants
from .base import BaseFobiBrowserBuldDynamicFormsTest
from .core import print_info, skip
from .core import print_info
from .data import (
TEST_FORM_ELEMENT_PLUGIN_DATA,
TEST_FORM_FIELD_DATA,
Expand Down Expand Up @@ -450,7 +450,6 @@ def _test_remove_form_handlers(self):
# +++++++++++++++++++++++++++ General +++++++++++++++++++++++++++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

@skip
@print_info
def test_1001_open_dashboard(self):
"""Test open dashboard."""
Expand All @@ -470,7 +469,6 @@ def test_1001_open_dashboard(self):
# ++++++++++++++++++++++ Form specific ++++++++++++++++++++++++++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

@skip
@print_info
def test_2001_add_form(self):
"""Test add a new form."""
Expand All @@ -486,19 +484,16 @@ def test_2001_add_form(self):
# )
# )

@skip
@print_info
def test_2002_edit_form(self):
"""Test edit a form."""
# TODO

@skip
@print_info
def test_2003_delete_form(self):
"""Test delete a form."""
# TODO

@skip
@print_info
def test_2004_submit_form(self, wait=WAIT_FOR):
"""Test submit form."""
Expand Down Expand Up @@ -546,7 +541,6 @@ def test_2004_submit_form(self, wait=WAIT_FOR):

self._sleep(wait)


# class FormElementSpecificFobiBrowserBuldDynamicFormsTest(
# BaseFobiBrowserBuldDynamicFormsTest):
# """Form element specific."""
Expand All @@ -555,18 +549,15 @@ def test_2004_submit_form(self, wait=WAIT_FOR):
# ++++++++++++++++++++ Form element specific ++++++++++++++++++++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

@skip
@print_info
def test_3001_add_form_elements(self, wait=WAIT_FOR):
"""Test adding form elements."""
# Clean up database
db_clean_up()
db_clean_up() # Clean up database

self._test_add_form_elements(create_form=True)

self._sleep(wait)

@skip
@print_info
def test_3002_remove_form_elements(self):
"""Test remove form element."""
Expand All @@ -577,10 +568,10 @@ def test_3002_remove_form_elements(self):

self._test_remove_form_elements()

@skip
@print_info
def test_3003_edit_form_elements(self):
"""Test edit form element."""
db_clean_up() # Clean up database


# class FormHandlerSpecificFobiBrowserBuldDynamicFormsTest(
Expand All @@ -591,32 +582,27 @@ def test_3003_edit_form_elements(self):
# ++++++++++++++++++++ Form handler specific ++++++++++++++++++++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

@skip
@print_info
def test_4001_add_form_handlers(self, wait=WAIT_FOR):
"""Test of adding a single form handler.
At this point, if form isn't created, it should be.
"""
# Clean up database
db_clean_up()
db_clean_up() # Clean up database

self._test_add_form_handlers(create_form=True)

self._sleep(wait)

@skip
@print_info
def test_4002_remove_form_handlers(self):
"""Test remove form handler."""
# Clean up database
db_clean_up()
db_clean_up() # Clean up database

self._test_add_form_handlers(create_form=True)

self._test_remove_form_handlers()

@skip
@print_info
def test_4003_edit_form_handlers(self):
"""Test edit form handler."""
Expand Down

0 comments on commit 01edc04

Please sign in to comment.