# unitary test for the pyrpl module

import unittest
import os

from pyrpl import RedPitaya


class RedPitayaTestCases(unittest.TestCase):

    def setUp(self):
        self.hostname = os.environ.get('REDPITAYA')

    def tearDown(self):
        pass

    def test_hostname(self):
        self.assertIsNotNone(
            self.hostname,
            msg="Set REDPITAYA=localhost or the ip of your board to proceed!")
        
    def test_connect(self):
        if self.hostname != "localhost":
            r = RedPitaya(hostname=self.hostname)
            self.assertEqual(r.hk.led, 0)
    
# unitary test for the pyrpl module

import unittest
import os

from pyrpl import RedPitaya


class RedPitayaTestCases(unittest.TestCase):

    def setUp(self):
        self.hostname = os.environ.get('REDPITAYA')
        self.password = os.environ.get('RP_PASSWORD') or 'root'

    def tearDown(self):
        pass

    def test_hostname(self):
        self.assertIsNotNone(
            self.hostname,
            msg="Set REDPITAYA=localhost or the ip of your board to proceed!")

    def test_password(self):
        self.assertIsNotNone(
            self.password,
            msg="Set RP_PASSWORD=<your redpitaya password> to proceed!")
        
    def test_connect(self):
        if self.hostname != "localhost":
            r = RedPitaya(hostname=self.hostname, password=self.password)
            self.assertEqual(r.hk.led, 0)
    
Update test_connect to read password from env. variable
Update test_connect to read password from env. variable
