Exemplo n.º 1
0
 def test_without_date_or_company(self):
     """
     Tests the get_directory_path function withuot a company and
     when the path does not contain date variables.
     """
     with patch.dict('sifter.mailsifter.attachments.settings.MAILSIFTER',
                     self.mock_mailsifter_settings):
         actual = attachments.get_directory_path()
         expected = 'test-attachments/'
         self.assertEqual(actual, expected)
Exemplo n.º 2
0
 def test_with_company_and_date(self):
     """
     Tests the get_directory_path function when the path contains
     date variables.
     """
     with patch('sifter.mailsifter.attachments.datetime') as mock_datetime:
         mock_datetime.utcnow = Mock(return_value=self.date)
         with patch.dict('sifter.mailsifter.attachments.settings.MAILSIFTER',
                         return_value=self.mock_mailsifter_settings):
             self.mock_settings.ATTACHMENTS_FOLDER = 'attachments/%Y/%m/%d/'
             actual = attachments.get_directory_path(self.company)
             expected = '2d6f5a38306a40f3a5e14fc38a425531/attachments/2016/12/10/'
             self.assertEqual(actual, expected)