def test_settings(self): """Test if settings are displayed properly""" wf._items = [] sys.argv = ['venmo.py', '>'] main(None) self.assertEqual(len(wf._items), 3) self.assertEqual(wf._items[0].title, LOGIN['title']) self.assertEqual(wf._items[1].title, LOGOUT['title']) self.assertEqual(wf._items[2].title, CLEAR_CACHE['title']) wf._items = []
def test_invalid_options(self): """Test if invalid option items is displayed""" wf._items = [] sys.argv = ['venmo.py', '> not here'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, INVALID['title']) self.assertFalse(wf._items[0].valid) self.assertFalse(wf._items[0].arg) wf._items = []
def test_logout(self): """Test if logout item is displayed properly""" wf._items = [] sys.argv = ['venmo.py', '> logout'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGOUT['title']) self.assertEqual(wf._items[0].arg, LOGOUT['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '>logout'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGOUT['title']) self.assertEqual(wf._items[0].arg, LOGOUT['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '> logout'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGOUT['title']) self.assertEqual(wf._items[0].arg, LOGOUT['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '> Logout'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGOUT['title']) self.assertEqual(wf._items[0].arg, LOGOUT['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '> LOGOUT'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGOUT['title']) self.assertEqual(wf._items[0].arg, LOGOUT['arg']) self.assertTrue(wf._items[0].valid) wf._items = []
def test_login(self): """Test if login item is displayed""" sys.argv = ['venmo.py', '> login'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGIN['title']) self.assertEqual(wf._items[0].arg, LOGIN['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '>login'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGIN['title']) self.assertEqual(wf._items[0].arg, LOGIN['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '> login'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGIN['title']) self.assertEqual(wf._items[0].arg, LOGIN['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '> Login'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGIN['title']) self.assertEqual(wf._items[0].arg, LOGIN['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '> LOGIN'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, LOGIN['title']) self.assertEqual(wf._items[0].arg, LOGIN['arg']) self.assertTrue(wf._items[0].valid) wf._items = []
def test_clear_cache(self): """Test if clear cache item is displayed properly""" wf._items = [] sys.argv = ['venmo.py', '> cl'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, CLEAR_CACHE['title']) self.assertEqual(wf._items[0].arg, CLEAR_CACHE['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '> clear C'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, CLEAR_CACHE['title']) self.assertEqual(wf._items[0].arg, CLEAR_CACHE['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '>cl'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, CLEAR_CACHE['title']) self.assertEqual(wf._items[0].arg, CLEAR_CACHE['arg']) self.assertTrue(wf._items[0].valid) wf._items = [] sys.argv = ['venmo.py', '> clear cache'] main(None) self.assertEqual(len(wf._items), 1) self.assertEqual(wf._items[0].title, CLEAR_CACHE['title']) self.assertEqual(wf._items[0].arg, CLEAR_CACHE['arg']) self.assertTrue(wf._items[0].valid) wf._items = []