-
Notifications
You must be signed in to change notification settings - Fork 20
[review] Cleaner api for loading the casper files #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # -*- coding: utf-8 -*- | ||
| from .helpers import BaseCasperJs | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # -*- coding: utf-8 -*- | ||
| from django.conf import settings | ||
| from .tests import CasperTestCase | ||
|
|
||
| import sys | ||
| import os.path | ||
|
|
||
|
|
||
| class BaseCasperJs(CasperTestCase): | ||
| """ | ||
| Base Class with helper methods to load casper tests | ||
| """ | ||
| @property | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so that it can be overriden |
||
| def test_path(self): | ||
| return os.path.dirname(sys.modules[self.__module__].__file__) | ||
|
|
||
| def load_casper_file(self, js_file, **kwargs): | ||
| casper_test_folder_path = kwargs.get('casper_test_folder', 'casper-tests') | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. user can override the casper-tests folder-name if they look here ;) |
||
|
|
||
| test_path = getattr(self, 'test_path', os.path.dirname(__file__)) | ||
|
|
||
| test_path = os.path.join(test_path, | ||
| casper_test_folder_path, | ||
| js_file | ||
| ) | ||
| kwargs.update({ | ||
| 'timeout': 30000, | ||
| 'casper_helper_js_path': kwargs.get('casper_helper_js_path', os.path.join(settings.SITE_ROOT, 'casper/jslib/djangocasper.js')), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is too long - 80 columns should be the max. I need to set up flake8 for this repository.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've not worked on this lib since; 2014. Is it still a decent pull? |
||
| 'STATIC_PATH': kwargs.get('STATIC_PATH', settings.STATIC_ROOT), | ||
| }) | ||
|
|
||
| return self.casper(test_path, **kwargs) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done as a helper so the user can just
instead of