Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pyup-scheduled-update-2019-09-16
- Loading branch information
Showing
17 changed files
with
160 additions
and
111 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,32 @@ | ||
from django.core import mail | ||
|
||
from base.tests.base import SeleniumTestCase | ||
|
||
|
||
class ContactFormTest(SeleniumTestCase): | ||
|
||
def test_contact_form(self): | ||
self.assertEqual(mail.outbox, []) | ||
|
||
username = 'john' | ||
usermail = 'lennon@thebeatles.com' | ||
message = f'this is a message' | ||
self.navigate('contact_form') | ||
|
||
username_textfield = self.driver.find_element_by_name('name') | ||
username_textfield.send_keys(username) | ||
mail_textfield = self.driver.find_element_by_name('email') | ||
mail_textfield.send_keys(usermail) | ||
message_textarea = self.driver.find_element_by_name('body') | ||
message_textarea.send_keys(message) | ||
|
||
with self.wait(): | ||
message_textarea.submit() | ||
|
||
self.assert_view('contact_form_sent') | ||
|
||
self.assertEqual(len(mail.outbox), 1) | ||
body: mail.EmailMessage = mail.outbox[0].body | ||
self.assertIn(username, body) | ||
self.assertIn(message, body) | ||
self.assertIn(usermail, body) |
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import logging | ||
|
||
from django.db import migrations | ||
|
||
from base import logic, parsing | ||
|
||
from ..models import League | ||
|
||
LOGGER = logging.getLogger('hbscorez') | ||
|
||
|
||
def update_league_names(*_): | ||
for league in League.objects.all(): | ||
dom = logic.get_html(league.source_url()) | ||
name = parsing.parse_league_name(dom) | ||
if name != league.name: | ||
league.name = name | ||
league.save() | ||
LOGGER.info('RENAMED LEAGUE: %s', league) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
atomic = False | ||
|
||
dependencies = [ | ||
('leagues', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(update_league_names), | ||
] |
Oops, something went wrong.