def test_minify_third_party_libs(self):

    def _mock_safe_delete_file(unused_filepath):
        'Mocks build.safe_delete_file().'
        pass
    self.assertFalse(os.path.isfile('core/tests/data/third_party/css/third_party.min.css'))
    self.assertFalse(os.path.isfile('core/tests/data/third_party/js/third_party.min.js'))
    self.assertFalse(os.path.isfile('core/tests/data/third_party/js/third_party.min.js.map'))
    with self.swap(build, 'safe_delete_file', _mock_safe_delete_file):
        build.minify_third_party_libs('core/tests/data/third_party')
    self.assertTrue(os.path.isfile('core/tests/data/third_party/css/third_party.min.css'))
    self.assertTrue(os.path.isfile('core/tests/data/third_party/js/third_party.min.js'))
    self.assertTrue(os.path.isfile('core/tests/data/third_party/js/third_party.min.js.map'))
    self.assertLess(os.path.getsize('core/tests/data/third_party/css/third_party.min.css'), os.path.getsize('core/tests/data/third_party/css/third_party.css'))
    self.assertLess(os.path.getsize('core/tests/data/third_party/js/third_party.min.js'), os.path.getsize('core/tests/data/third_party/js/third_party.js'))
    build.safe_delete_file('core/tests/data/third_party/css/third_party.min.css')
    build.safe_delete_file('core/tests/data/third_party/js/third_party.min.js')
    build.safe_delete_file('core/tests/data/third_party/js/third_party.min.js.map')
def test_minify_third_party_libs(self):

    def _mock_safe_delete_file(unused_filepath):
        'Mocks build.safe_delete_file().'
        pass
    self.assertFalse(os.path.isfile('core/tests/data/third_party/css/third_party.min.css'))
    self.assertFalse(os.path.isfile('core/tests/data/third_party/js/third_party.min.js'))
    self.assertFalse(os.path.isfile('core/tests/data/third_party/js/third_party.min.js.map'))
    with self.swap(build, 'safe_delete_file', _mock_safe_delete_file):
        build.minify_third_party_libs('core/tests/data/third_party')
    self.assertTrue(os.path.isfile('core/tests/data/third_party/css/third_party.min.css'))
    self.assertTrue(os.path.isfile('core/tests/data/third_party/js/third_party.min.js'))
    self.assertTrue(os.path.isfile('core/tests/data/third_party/js/third_party.min.js.map'))
    self.assertLess(os.path.getsize('core/tests/data/third_party/css/third_party.min.css'), os.path.getsize('core/tests/data/third_party/css/third_party.css'))
    self.assertLess(os.path.getsize('core/tests/data/third_party/js/third_party.min.js'), os.path.getsize('core/tests/data/third_party/js/third_party.js'))
    build.safe_delete_file('core/tests/data/third_party/css/third_party.min.css')
    build.safe_delete_file('core/tests/data/third_party/js/third_party.min.js')
    build.safe_delete_file('core/tests/data/third_party/js/third_party.min.js.map')