April Fedora Meetup – Started My Contribution to Fedora
I am a Fedora member since last year (here is wiki page).
To be Frank I don’t know from where I can Start my Contribution to OpenSource. But from yesterday(24th April 2016) I got the right direction to my Contribution. I attended the Fedora Meetup. In Fedora Meetup Kushal Das, Chandan Kumar, Praveen Kumar gave a direction to my Contribution.
In Fedora Meetup, they told us regarding Unit Testing. As we are not much familiar with Unit Testing Kushal gave us a small but useful demonstration on “How system commands are to be tested”. We started as a beginning of the Unit Testing on system command ‘cat’ Following is snippet of the MyFirstCode,
import unittest from testutils import system class Firetest(unittest.TestCase): def test_cat(self): out,err,retcode= system("cat /etc/fedora-release") out = out.decode('utf-8') self.assertIn('Fedora',out) if __name__ == '__main__': unittest.main()
For above code, he gave us a link to use some class and methods, here is the link. We cloned this repository and started writing Unit Test on ‘cat’.
It is too difficult that many people are working on same system command, so Kushal gives different commands to each of us. We started writing Unit Test on it.
(Interesting thing while doing all the stuff, we had tasty snacks and drinks too 🙂 )
The task assign me is Check the error code status of “sudo su test_satyajit;exit”. I had written that test case too. Here is a snippet of it.
import unittest from testutils import system class Firetest(unittest.TestCase): """#docstring for Firetest"unittest.TestCase def __init__(self, arg): #super(Firetest,unittest.TestCase.__init__() #self.arg = arg """ def test_cat(self): out, err, retcode = system("sudo useradd test_satyajit") self.assertEqual(retcode, 0, out) out, err, retcode = system("cat /etc/passwd") self.assertEqual(retcode, 0, out) out = out.decode("utf-8") self.assertIn('test_satyajit', out) out, err, retcode = system("sudo su test_satyajit; exit") self.assertEqual(retcode, 0, out) out, err, retcode = system("sudo userdel test_satyajit") self.assertEqual(retcode, 0, out) if __name__ == '__main__': unittest.main()
While enjoying with the Unit Testing, I interacted with many fellows and get enhanced my knowledge and also their. Here are some Pics from Meetup…
After all, This meetup was Very Good !!! Once again Thanks to Kushal Das, Chandan Kumar and PraveenKumar for arranging this Meetup.