Exemplo n.º 1
0
    def test_githubkeymaker_apikeys_file(self):
        """
        Testing ability to create single key using consumer token/secret from JSON file
        """
        gk = emm.GithubKeymaker()

        gk.set_apikeys_file(self.keypath)

        # Note that we hard-code these key values in the setup method above...
        self.assertEqual(gk.credentials[self.token_var.lower()], 'AAAAA')
        self.assertEqual(gk.credentials[self.secret_var.lower()], 'BBBBB')
Exemplo n.º 2
0
    def test_githubkeymaker_apikeys_dict(self):
        """
        Testing ability to create single key using consumer token/secret from dictionary
        """
        gk = emm.GithubKeymaker()

        # Set application API keys
        gk.set_apikeys_dict({
            self.token_var.lower(): 'EEEEE',
            self.secret_var.lower(): 'FFFFF'
        })

        self.assertEqual(gk.credentials[self.token_var.lower()], 'EEEEE')
        self.assertEqual(gk.credentials[self.secret_var.lower()], 'FFFFF')
Exemplo n.º 3
0
    def test_githubkeymaker_apikeys_env(self):
        """
        Testing ability to create single key using consumer token from environment vars
        """
        gk = emm.GithubKeymaker()

        # Set application API keys
        os.environ['CLIENT_ID'] = 'CCCCC'
        os.environ['CLIENT_SECRET'] = 'DDDDD'

        gk.set_apikeys_env()

        self.assertEqual(gk.credentials[self.token_var.lower()], 'CCCCC')
        self.assertEqual(gk.credentials[self.secret_var.lower()], 'DDDDD')

        # Clean up
        os.environ['CLIENT_ID'] = ''
        os.environ['CLIENT_SECRET'] = ''
import embarcaderomindmachine as emm
"""
Run this example like:

$ CLIENT_ID="XXXXX" \
  CLIENT_SECRET="XXXXXXXX" \
  python one_bot.py

Where CLIENT_ID and CLIENT_SECRET are 
from your app page on Github.
"""

ghk = emm.GithubKeymaker()
ghk.set_apikeys_env()
ghk.make_a_key('dummy', 'dummy.json', '/tmp/keys')
Exemplo n.º 5
0
 def test_githubkeymaker_constructor(self):
     """
     Running a smoke test for the GithubKeymaker class
     """
     gk = emm.GithubKeymaker()