'Test the "compile_sass" task.'

@ddt.data([''], ['--force'], ['--debug'], ['--system=lms'], ['--system=lms    --force'], ['--system=studio'], ['--system=studio    --force'], ['--system=lms,studio'], ['--system=lms,studio    --force'])
@ddt.unpack
def test_compile_sass(self, options):

    parameters = options.split('    ')
    system = []
    if ('--system=studio' not in parameters):
        system += ['lms']
    if ('--system=lms' not in parameters):
        system += ['studio']
    debug = ('--debug' in parameters)
    force = ('--force' in parameters)
    self.reset_task_messages()
    call_task('pavelib.assets.compile_sass', options={'system': system, 'debug': debug, 'force': force})
    expected_messages = []
    if force:
        expected_messages.append('rm    -rf    common/static/css/*.css')
    expected_messages.append('libsass    common/static/sass')
    if ('lms' in system):
        if force:
            expected_messages.append('rm    -rf    lms/static/css/*.css')
        expected_messages.append('libsass    lms/static/sass')
        if force:
            expected_messages.append('rm    -rf    lms/static/certificates/css/*.css')
        expected_messages.append('libsass    lms/static/certificates/sass')
    if ('studio' in system):
        if force:
            expected_messages.append('rm    -rf    cms/static/css/*.css')
        expected_messages.append('libsass    cms/static/sass')
    self.assertEquals(self.task_messages, expected_messages)
