Exemple #1
0
    def test_adapt_data_handle_default_value_fields(self, mock_datetime):
        test_datetime = datetime(2014, 01, 31, 0, 0)
        mock_datetime.now.return_value = test_datetime
        data = {
            '_id':4, 'pdf_file': {'x':1}, 'epub_file': 'x' 
        }
        adapted = adapt_data(data)

        self.assertEquals(adapted, {'datestamp': test_datetime, 'identifier':4, 'formats': ['pdf', 'epub']})
Exemple #2
0
    def test_adapt_data_ignore_non_mapped_fields(self, mock_datetime):
        test_datetime = datetime(2014, 01, 31, 0, 0)
        mock_datetime.now.return_value = test_datetime
        data = {
            'a':1, 'b':2, 'c':3, '_id':4
        }
        adapted = adapt_data(data)

        self.assertEquals(adapted, {'datestamp': test_datetime, 'identifier':4})