def test_makes_description_html(self, htmlify_method): "When save() is called description_html should be created from raw JSON" htmlify_method.return_value = 'my test description' user = UserFactory() user.raw = '{"description":"my test description"}' user.save() htmlify_method.assert_called_once_with( {'description': 'my test description'}) self.assertEqual(user.description_html, 'my test description')
def test_going_public(self): "Makes the user's tweets public if they go public" # Start off private: user = UserFactory(is_private=True) tweet = TweetFactory(user=user) self.assertTrue(tweet.is_private) # Now change to public: user.is_private = False # Should change the user's tweets to public: user.save() tweet.refresh_from_db() self.assertFalse(tweet.is_private)