def test_filename_format(self): self.assertEquals( 'documents/2/1-pricing-document-123.pdf', generate_file_name( 2, 1, 'pricingDocumentURL', 'test.pdf', suffix='123' ))
def test_default_suffix_is_datetime(self): now = datetime.datetime(2015, 1, 2, 3, 4, 5, 6) with mock.patch.object(datetime, 'datetime', mock.Mock(wraps=datetime.datetime)) as patched: patched.utcnow.return_value = now self.assertEquals( 'documents/2/1-pricing-document-2015-01-02-0304.pdf', generate_file_name( 2, 1, 'pricingDocumentURL', 'test.pdf', ))