def test_substitution_default(self):
        django_test = get_available_commands().get('cthulhubot-django-unit-test-config')

        self.assert_equals(["python", "setup.py", "configtest", "-f",
            "--database-config-file=fajl.py", "--django-settings-directory=tests/unit_project/settings",
        ], django_test(config={
            "database_config_file" : "fajl.py"
        }).get_command())
    def handle(self, *fixture_labels, **options):
        verbosity = int(options.get('verbosity', 1))
        commit = int(options.get('commit', 1))
        if verbosity > 1:
            print 'Discovering jobs'

        self.store_discoverables(JobCommand, get_available_commands().keys(), verbosity)
        self.store_discoverables(Job, get_available_jobs().keys(), verbosity)
        
        if commit and transaction.is_managed():
            if verbosity > 1:
                print 'Commiting jobs...'
            transaction.commit()
    def test_substitution_required_not_provided(self):
        klass = get_available_commands().get('cthulhubot-django-unit-test-config')
        cmd = klass(config={})

        self.assert_raises(UnconfiguredCommandError, cmd.get_command)