-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #315 from cfpb/dev
Dev => Master
- Loading branch information
Showing
128 changed files
with
13,691 additions
and
994 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
module.exports = { | ||
presets: [ | ||
'react-app' | ||
], | ||
plugins: [ | ||
'@babel/plugin-proposal-class-properties' | ||
] | ||
} |
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 |
---|---|---|
@@ -1,24 +1,37 @@ | ||
from django.test import RequestFactory, SimpleTestCase | ||
from unittest.mock import patch | ||
|
||
from ccdb5_ui.views import CCDB5MainView | ||
from django.test import RequestFactory, SimpleTestCase | ||
|
||
|
||
class CCDB5MainViewTest(SimpleTestCase): | ||
def setUp(self): | ||
self.factory = RequestFactory() | ||
self.view = CCDB5MainView.as_view() | ||
|
||
def test_get_supported_user_agent(self): | ||
@patch('ccdb5_ui.views.flag_enabled') | ||
def test_get_supported_user_agent(self, mock_flag_enabled): | ||
mock_flag_enabled.return_value = True | ||
|
||
request = self.factory.get('/', HTTP_USER_AGENT="Foo") | ||
response = self.view(request) | ||
self.assertContains(response, "Search the Consumer Complaint Database") | ||
mock_flag_enabled.assert_called_once_with('CCDB5_TRENDS') | ||
|
||
@patch('ccdb5_ui.views.flag_enabled') | ||
def test_get_unsupported_user_agent(self, mock_flag_enabled): | ||
mock_flag_enabled.return_value = True | ||
|
||
def test_get_unsupported_user_agent(self): | ||
request = self.factory.get('/', HTTP_USER_AGENT="MSIE 8.0;") | ||
response = self.view(request) | ||
self.assertContains(response, "A more up-to-date browser is required") | ||
mock_flag_enabled.assert_called_once_with('CCDB5_TRENDS') | ||
|
||
@patch('ccdb5_ui.views.flag_enabled') | ||
def test_get_no_user_agent(self, mock_flag_enabled): | ||
mock_flag_enabled.return_value = True | ||
|
||
def test_get_no_user_agent(self): | ||
request = self.factory.get('/') | ||
response = self.view(request) | ||
self.assertContains(response, "Search the Consumer Complaint Database") | ||
mock_flag_enabled.assert_called_once_with('CCDB5_TRENDS') |
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
Oops, something went wrong.