def setUp(self): from micard.api import API from micard.auth import OAuthHandler auth = OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(user_token, user_secret) self.api = API(auth)
def test_supplement_registration(self): from micard.api import API from micard.error import MicardError from micard.auth import OAuthHandler import datetime auth = OAuthHandler(consumer_key, consumer_secret) auth.get_authorization_url() token = auth.request_token.key api = API(auth) supp = api.create_registration_supplement( consumer_key=consumer_key, token=token, email='*****@*****.**', first_name='first', last_name='last', phone=5555551234, address='101 Street St.', city='Orlando', state='Fl', zip_code=32817, gender='m', dob='15 July, 1984', emergency_name='first last sr.', emergency_number=5555551235, emergency_number_alt=5555551236, physician_name='Dr. First Last', physician_number=5555551237, power_of_attorney='First Last, J.D.', power_of_attorney_number=5555551238 ) # This will fail because the token above has already been supplemented self.assertRaises(MicardError, api.create_registration_supplement, { 'consumer_key':consumer_key, 'token': token, }) api.delete_registration_supplement( consumer_key=consumer_key, token=token )
class AuthTests(unittest.TestCase): def setUp(self): from micard.auth import OAuthHandler self.auth = OAuthHandler(consumer_key, consumer_secret) def test_request_token(self): self.auth._get_request_token() def test_get_auth_url(self): self.auth.get_authorization_url(register=False) self.auth.get_authorization_url(register=True)
def setUp(self): from micard.auth import OAuthHandler self.auth = OAuthHandler(consumer_key, consumer_secret)