'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_theme_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, 'theme_dirs': [TEST_THEME.dirname()], 'themes': [TEST_THEME.basename()]})
    expected_messages = []
    if force:
        expected_messages.append('rm    -rf    common/static/css/*.css')
    expected_messages.append('libsass    common/static/sass')
    if ('lms' in system):
        expected_messages.append(('mkdir_p    ' + repr((TEST_THEME / 'lms/static/css'))))
        if force:
            expected_messages.append((('rm    -rf    ' + str(TEST_THEME)) + '/lms/static/css/*.css'))
        expected_messages.append('libsass    lms/static/sass')
        if force:
            expected_messages.append((('rm    -rf    ' + str(TEST_THEME)) + '/lms/static/css/*.css'))
        expected_messages.append((('libsass    ' + str(TEST_THEME)) + '/lms/static/sass'))
        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):
        expected_messages.append(('mkdir_p    ' + repr((TEST_THEME / 'cms/static/css'))))
        if force:
            expected_messages.append((('rm    -rf    ' + str(TEST_THEME)) + '/cms/static/css/*.css'))
        expected_messages.append('libsass    cms/static/sass')
        if force:
            expected_messages.append((('rm    -rf    ' + str(TEST_THEME)) + '/cms/static/css/*.css'))
        expected_messages.append((('libsass    ' + str(TEST_THEME)) + '/cms/static/sass'))
        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)
