Skip to content

Commit

Permalink
Fix tests: tests have to run in READ_ONLY=False mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
tibonihoo committed Apr 7, 2019
1 parent c373fb1 commit ff118a1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
26 changes: 13 additions & 13 deletions wom_user/test_tributary.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ def test_without_timeline_not_twitter_info_context_has_no_info(self):
self.assertEqual(200, resp.status_code)
oauth_status = resp.context["twitter_oauth_status"]
self.assertEqual(None, oauth_status)
summary = resp.context["twitter_timelines_summary"]
self.assertEqual(0, len(summary))
summary = resp.context["twitter_timelines_recap"]
self.assertEqual(None, summary)

@mock.patch('wom_user.views.twitter_oauth.try_get_authorized_client')
@mock.patch('wom_user.views.twitter_oauth.generate_authorization_url')
@mock.patch('wom_tributary.utils.twitter_oauth.try_get_authorized_client')
@mock.patch('wom_tributary.utils.twitter_oauth.generate_authorization_url')
def test_with_twitter_info_but_no_auth_context_has_auth_link(self,
mocked_generate_auth_url,
mocked_try_get_auth_client):
Expand All @@ -204,8 +204,8 @@ def test_with_twitter_info_but_no_auth_context_has_auth_link(self,
self.assertEqual(mocked_generate_auth_url.return_value,
oauth_status.auth_url)

@mock.patch('wom_user.views.twitter_oauth.try_get_authorized_client')
@mock.patch('wom_user.views.twitter_oauth.generate_authorization_url')
@mock.patch('wom_tributary.utils.twitter_oauth.try_get_authorized_client')
@mock.patch('wom_tributary.utils.twitter_oauth.generate_authorization_url')
def test_when_authorized_context_has_no_auth_link(self,
mocked_generate_auth_url,
mocked_try_get_auth_client):
Expand All @@ -221,8 +221,8 @@ def test_when_authorized_context_has_no_auth_link(self,
self.assertEqual(True, oauth_status.is_auth)
self.assertEqual(None, oauth_status.auth_url)

@mock.patch('wom_user.views.twitter_oauth.try_get_authorized_client')
@mock.patch('wom_user.views.twitter_oauth.generate_authorization_url')
@mock.patch('wom_tributary.utils.twitter_oauth.try_get_authorized_client')
@mock.patch('wom_tributary.utils.twitter_oauth.generate_authorization_url')
def test_with_timelines_when_authorized_context_has_no_auth_link(self,
mocked_generate_auth_url,
mocked_try_get_auth_client):
Expand All @@ -238,13 +238,13 @@ def test_with_timelines_when_authorized_context_has_no_auth_link(self,
oauth_status = resp.context["twitter_oauth_status"]
self.assertEqual(True, oauth_status.is_auth)
self.assertEqual(None, oauth_status.auth_url)
summary = resp.context["twitter_timelines_summary"]
summary = resp.context["twitter_timelines_recap"]
self.assertEqual(2, len(summary))
self.assertEqual(3, summary[0].num_item_retrieved)
self.assertEqual(3, summary[1].num_item_retrieved)
self.assertTrue(summary[0].fetchable)
self.assertTrue(summary[1].fetchable)

@mock.patch('wom_user.views.twitter_oauth.try_get_authorized_client')
@mock.patch('wom_user.views.twitter_oauth.generate_authorization_url')
@mock.patch('wom_tributary.utils.twitter_oauth.try_get_authorized_client')
@mock.patch('wom_tributary.utils.twitter_oauth.generate_authorization_url')
def test_with_timelines_when_get_has_oauth_token_it_is_passed_to_try_get_authorized_client(self,
mocked_generate_auth_url,
mocked_try_get_auth_client):
Expand Down
3 changes: 3 additions & 0 deletions wom_user/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# along with WaterOnMars. If not, see <http://www.gnu.org/licenses/>.
#

from django.conf import settings
settings.READ_ONLY = False

from test_view_decorators import *
from test_userprofile import *
from test_collection import *
Expand Down
2 changes: 0 additions & 2 deletions wom_user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,6 @@ def from_feed(f, twitter_status):
d = fetch_timeline_data(
f.twittertimeline, twitter_status, 1)
t = TwitterTimelineInfo(f, f.twittertimeline, len(d)>0)
# s = tweet_summarizers.generate_basic_html_summary(d)
# t.tmp_content_summary = "\n".join(s)
return t


Expand Down

0 comments on commit ff118a1

Please sign in to comment.