def test_convert_price(self): attributes = { 'description': '', 'price': '6.28', 'publish_date': datetime.now().strftime(parser.DATE_FORMAT) } parser.convert_attributes(attributes) self.assertEqual(6.28, attributes['price'])
def test_convert_date(self): attributes = { 'description': '', 'price': '0', 'publish_date': '2015-04-03' } parser.convert_attributes(attributes) date = datetime(2015, 4, 3) self.assertEqual(date, attributes['publish_date'])
def test_convert_description(self): before = 'Lorem ipsum dolor sit amet, \n consectetur adipiscing elit,\n sed do eiusmod tempor\n incididunt ut labore et dolore magna aliqua.' attributes = { 'description': before, 'price': '0', 'publish_date': datetime.now().strftime(parser.DATE_FORMAT) } parser.convert_attributes(attributes) self.assertEqual( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', attributes['description'])