# 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)
    
@@ -205,16 +205,80 @@
 PITAYA')
+%0A        self.password = os.environ.get('RP_PASSWORD') or 'root'
 %0A%0A    de
@@ -473,16 +473,176 @@
 oceed!%22)
+%0A%0A    def test_password(self):%0A        self.assertIsNotNone(%0A            self.password,%0A            msg=%22Set RP_PASSWORD=%3Cyour redpitaya password%3E to proceed!%22)
 %0A       
@@ -712,16 +712,16 @@
 lhost%22:%0A
-
         
@@ -760,16 +760,40 @@
 hostname
+, password=self.password
 )%0A      

Update test_connect to read password from env. variable