Skip to content

Commit

Permalink
#685 Grade django to 1.11.17 (#686)
Browse files Browse the repository at this point in the history
* Grade django to 1.11.17

* Remove --liveserver argument from tests. Create LIVESERVER_{PORT,HOST}.

* Remove LIVESERVER_PORT. Fix rendering of payment types.

* Trigger CI

* Finish with host address for selenium

* Self-review fixes
  • Loading branch information
ArtemijRodionov authored Jan 8, 2019
1 parent 4dd7bbc commit eb3ef4d
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pipeline:
slow-test:
<<: *test
commands:
- python manage.py test --liveserver=slow-test:8021-8029 --parallel --tag slow -k -v 3
- python manage.py test --parallel --tag slow -k -v 3

lint-coala:
<<: *lint
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ dc exec app python manage.py price
make test
# запускаем один тест
dc exec app python manage.py test -v 3 --liveserver=app:8021-8029 \
stroyprombeton.tests.tests_selenium.CartTestCase.buy_on_product_page
dc exec app python manage.py test shopelectro.tests.tests_selenium.TestClass.test_method
```

#### Fixtures
Expand Down
2 changes: 1 addition & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ collectstatic:

test: build-static
$(dc) up -d app selenium
$(dc) exec app python manage.py test -v 3 --liveserver=app-server:8020-8030 --parallel
$(dc) exec app python manage.py test -v 3 --parallel
$(dc) stop

lint-code:
Expand Down
1 change: 0 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ x-app-base: &app-base
- PYTHONUNBUFFERED=0
ports:
- $VIRTUAL_HOST_EXPOSE_PORT:$VIRTUAL_HOST_PORT
- $VIRTUAL_HOST_LIVESERVER_PORT
networks:
se-backend:
aliases:
Expand Down
1 change: 0 additions & 1 deletion docker/drone_env/ports
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Exposed ports
VIRTUAL_HOST_PORT=8000
VIRTUAL_HOST_EXPOSE_PORT=8012
VIRTUAL_HOST_LIVESERVER_PORT=8020-8030
VIRTUAL_HOST_STAGE_PORT=8001
VIRTUAL_HOST_STAGE_EXPOSE_PORT=8011
1 change: 0 additions & 1 deletion docker/env_files/ports.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Exposed ports
VIRTUAL_HOST_PORT=8000
VIRTUAL_HOST_EXPOSE_PORT=8010
VIRTUAL_HOST_LIVESERVER_PORT=8020-8030
VIRTUAL_HOST_STAGE_PORT=8001
VIRTUAL_HOST_STAGE_EXPOSE_PORT=8011
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ beautifulsoup4

# celery==4.2.2
git+https://github.com/celery/celery.git@1c3a15938d0b9dde674d4666689d6a6c733d64e4#egg=celery
Django==1.10
Django==1.11.17
django-debug-toolbar==1.10.1
django-extensions
django-redis==4.8.0
Expand Down
4 changes: 4 additions & 0 deletions shopelectro/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import os
import socket
from datetime import datetime

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
Expand Down Expand Up @@ -221,6 +222,9 @@
}

TEST_RUNNER = 'refarm_test_utils.runners.RefarmTestRunner'
# address for selenium-based tests
# host name doesn't resolve at CI, so we have to use host address
LIVESERVER_HOST = socket.gethostbyname(socket.gethostname())

SITE_CREATED = datetime(2013, 1, 1)

Expand Down
3 changes: 2 additions & 1 deletion shopelectro/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class SeleniumTestCase(LiveServerTestCase):
"""Common superclass for running selenium-based tests."""

fixtures = ['dump.json']
host = settings.LIVESERVER_HOST

@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -89,7 +90,7 @@ def setUpClass(cls):
def tearDownClass(cls):
"""Close selenium session."""
cls.browser.quit()
super(SeleniumTestCase, cls).tearDownClass()
super().tearDownClass()

@contextmanager
def screen_fail(self, filename=''):
Expand Down
1 change: 1 addition & 0 deletions shopelectro/tests/tests_selenium_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class MobileSeleniumTestCase(LiveServerTestCase):
"""Common superclass for running selenium-based tests."""

fixtures = ['dump.json']
host = settings.LIVESERVER_HOST

@classmethod
def setUpClass(cls):
Expand Down
2 changes: 1 addition & 1 deletion templates/ecommerce/order/payment_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{% for radio in form.payment_type %}
<div class="payment-types-form-item">
{{ radio }}
<img src="{% static 'images/pay/'|add:radio.choice_value|add:'.png' %}" >
<img src="{% static 'images/pay/'|add:radio.data.value|add:'.png' %}" >
</div>
{% endfor %}

0 comments on commit eb3ef4d

Please sign in to comment.