class TestRemoteComputer(DestructiveDatabaseTestCase):
    def setUp(self):
        super(TestRemoteComputer, self).setUp()

        self.key = getattr(settings, "TEST_CTHULHUBOT_BUILD_COMPUTER_KEY", None)
        if not self.key:
            raise self.SkipTest("Cannot test remote commands without configured key")

        self.host = getattr(settings, "TEST_CTHULHUBOT_BUILD_COMPUTER_HOST")
        if not self.host:
            raise self.SkipTest("Cannot test remote commands without configured host")

        self.user = getattr(settings, "TEST_CTHULHUBOT_BUILD_COMPUTER_USERNAME", "buildbot")

        self.computer = BuildComputer(ssh_key=self.key, hostname=self.host, username=self.user)

    def test_connection_without_exception(self):
        self.computer.connect()
        
    def test_check_build_directory_not_exists_by_default(self):
        self.computer.connect()
        self.assert_false(self.computer.build_directory_exists("/does/not/exists"))

    def test_auto_connection(self):
        self.assert_false(self.computer.build_directory_exists("/does/not/exists"))

    def tearDown(self):
        self.computer.disconnect()

        super(TestRemoteComputer, self).tearDown()
    def setUp(self):
        super(TestRemoteComputer, self).setUp()

        self.key = getattr(settings, "TEST_CTHULHUBOT_BUILD_COMPUTER_KEY", None)
        if not self.key:
            raise self.SkipTest("Cannot test remote commands without configured key")

        self.host = getattr(settings, "TEST_CTHULHUBOT_BUILD_COMPUTER_HOST")
        if not self.host:
            raise self.SkipTest("Cannot test remote commands without configured host")

        self.user = getattr(settings, "TEST_CTHULHUBOT_BUILD_COMPUTER_USERNAME", "buildbot")

        self.computer = BuildComputer(ssh_key=self.key, hostname=self.host, username=self.user)