예제 #1
0
    def test_files_to_be_updated_query(self, mock_sql):
        mock_sql.return_value = [(
            '1',
            'item1_1.sql',
        )]
        sync = FileSync()

        sync.file_dict = {'item1': 'item1_2.txt', 'item2': 'item2_2.txt'}
        sync.files_to_be_updated()
        mock_sql.assert_called_with(
            '\n            SELECT file.file_id, file.file_title FROM file WHERE file_title SIMILAR TO %s;\n        ',
            ('(item1|item2)%'))
예제 #2
0
    def test_files_to_be_updated_files_to_upload(self, mock_sql):
        mock_sql.return_value = [
            (
                '1',
                'item1_1.sql',
            ),
        ]
        sync = FileSync()

        sync.file_dict = {'item1': 'item1_2.txt', 'item2': 'item2_2.txt'}
        files_to_upload = sync.files_to_be_updated()
        self.assertEqual(files_to_upload[0]._asdict(), {
            'item_number': 'item1',
            'file_id': '1',
            'file_name': 'item1_2.txt'
        })