new_contents: import os
  
  import mock
  from django.test import TestCase
  
  from habitica_slack import views
  
  
  class ViewsTestCase(TestCase):
      def setUp(self):
          self.slackToken = 'token'
  
          os.environ['SLACK_TOKEN'] = self.slackToken
  
      def test_sync_message_to_habitica_with_valid_token(self):
          # arrange
          user_name = 'Joe'
          text = 'Hello'
  
          dummy_request = self.create_dummy_post_request()
          dummy_request.POST = {
              'token': self.slackToken,
              'user_name': user_name,
              'text': text
          }
  
          views.actions.send_message_to_habitica = mock.Mock()
  
          # act
          response = views.sync_message_to_habitica(dummy_request)
  
          # assert
          # noinspection PyUnresolvedReferences
          views.actions.send_message_to_habitica.assert_called_with(user_name, text)
          self.assertEquals(response.content, '')
          self.assertEquals(response.status_code, 200)
  
      def test_sync_message_to_habitica_with_invalid_token(self):
          # arrange
          dummy_request = self.create_dummy_post_request()
          dummy_request.POST = {}
          views.actions.send_message_to_habitica = mock.Mock(return_value=None)
  
          # act
          response = views.sync_message_to_habitica(dummy_request)
  
          # assert
          # noinspection PyUnresolvedReferences
          views.actions.send_message_to_habitica.assert_not_called()
          self.assertEquals(response.content, '')
          self.assertEquals(response.status_code, 401)
  
      def test_sync_messages_to_slack(self):
          # arrange
          dummy_request = self.create_dummy_post_request()
          views.actions.sync_messages_to_slack = mock.Mock(return_value=None)
  
          # act
          response = views.sync_messages_to_slack(dummy_request)
  
          # assert
          # noinspection PyUnresolvedReferences
          views.actions.sync_messages_to_slack.assert_called_with()
          self.assertEquals(response.content, '')
          self.assertEquals(response.status_code, 200)
  
      def create_dummy_post_request(self):
          dummy_request = type('', (), {})()
          dummy_request.POST = {}
  
          return dummy_request
  
subject: Add tests for views