Skip to content

Instantly share code, notes, and snippets.

@muonzoo
Last active September 19, 2015 21:17
Show Gist options
  • Save muonzoo/0fe4838faa2691e6f061 to your computer and use it in GitHub Desktop.
Save muonzoo/0fe4838faa2691e6f061 to your computer and use it in GitHub Desktop.
Quick keyring test code
import unittest
import keyring
url=r'http://urlwatch.example.com/'
user='alice'
password =r'12345not_a_good_password'
class TestKeyring(unittest.TestCase):
@classmethod
def setUpClass(cls):
try:
keyring.delete_password(url,user)
except:
pass
def test_keyring_set(self):
self.assertEqual(keyring.set_password(url,user,password),None)
self.assertEqual(keyring.get_password(url,user),password)
@classmethod
def tearDownClass(cls):
keyring.delete_password(url,user)
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment