import os
from unittest import TestCase

from hotrc.hotrc import HotRC


class TestHotRC(TestCase):
    hotrc = None

    @classmethod
    def setUpClass(cls):
        cls.rcfile = '{}/.testrc'.format(os.path.dirname(__file__))
        open(cls.rcfile, 'w+').close()
        cls.hotrc = HotRC(bashrc=cls.rcfile)

    @classmethod
    def tearDownClass(cls):
        os.remove(cls.rcfile)

    def test_rcfile(self):
        self.assertTrue(os.path.isfile(self.hotrc.BASHRC))

@@ -145,32 +145,95 @@
 etUpClass(cls):%0A
+        ''' Create a test rc file and a hotrc object prove '''%0A
         cls.rcfi
@@ -284,16 +284,16 @@
 ile__))%0A
-
         
@@ -406,32 +406,84 @@
 DownClass(cls):%0A
+        ''' Remove the test rc file after tests '''%0A
         os.remov
@@ -524,16 +524,66 @@
 (self):%0A
+        ''' Make sure the rc file was created '''%0A
         
@@ -633,8 +633,2432 @@
 ASHRC))%0A
+%0A    def test_read_bashrc(self):%0A        ''' Make sure the content is being read from the%0A        rc file correctly.%0A        '''%0A        content = 'foo'%0A        with open(self.hotrc.BASHRC, 'w+') as f:%0A            f.write(content)%0A        result = self.hotrc.read_bashrc()%0A        self.assertIn(content, result)%0A%0A    def test_write_to_bashrc(self):%0A        ''' Tests that a key and value are%0A        correctly added to the rc file.%0A        '''%0A        key = 'foo'%0A        value = 'bar'%0A        self.hotrc.write_to_bashrc(key, value)%0A        result = self.hotrc.read_bashrc()%0A        self.assertIn(key, result)%0A        self.assertIn(value, result)%0A%0A    def test_get_info(self):%0A        ''' Tests that the get_info() function is%0A        able to properly parse info from the rc file.%0A        '''%0A        test_info = '%7B%7D/test_info'.format(os.path.dirname(__file__))%0A        with open(test_info, 'w+') as f:%0A            f.write(self.hotrc.BASHRC)%0A        temp = self.hotrc.BASHRC%0A        self.hotrc.BASHRC = ''%0A        self.hotrc.get_info(test_info)%0A        self.assertEqual(self.hotrc.BASHRC, temp)%0A        os.remove(test_info)%0A%0A    def test_get_aliases(self):%0A        ''' Tests to make sure the aliases are read%0A        from the rc file correctly.%0A        '''%0A        self.hotrc.write_to_bashrc('foo', 'bar')%0A        result = self.hotrc.get_aliases()%0A        self.assertIn(str(result), %22%7B'foo': 'bar'%7D%22)%0A%0A    def test_create_alias(self):%0A        ''' Tests to make sure an alias is created correctly. '''%0A        key = 'foo'%0A        value = 'bar'%0A        self.hotrc.create_alias(key, value)%0A        result = self.hotrc.get_aliases()%0A        self.assertIn(key, result.keys())%0A        self.assertEqual(str(value), str(result.get(key, None)).replace('%22',''))%0A%0A    def test_remove_alias(self):%0A        ''' Tests to ensure an alias can be properly removed '''%0A        key = 'foo'%0A        value = 'bar'%0A        self.hotrc.write_to_bashrc(key, value)%0A        result = self.hotrc.get_aliases()%0A        self.assertIn(key, result.keys())%0A        self.hotrc.remove_alias(key)%0A        result = self.hotrc.get_aliases()%0A        self.assertNotIn(key, result.keys())%0A%0A%0A    def test_get_index_range_of_definitions(self):%0A        ''' Tests to make sure the index of the rc file where the HOTRC%0A        definitions begin exists.%0A        '''%0A        result = self.hotrc.get_index_range_of_definitions()%0A        self.assertNotEqual(result%5B0%5D, -1)%0A%0A

Add more tests for hotrc methods