Skip to content

Commit

Permalink
Added Full Test Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
gtalarico committed Sep 24, 2017
1 parent f94bc8d commit bcca1fc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_airtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import requests
import uuid
from requests.exceptions import HTTPError

from airtable import Airtable
from airtable.auth import AirtableAuth
Expand Down Expand Up @@ -48,6 +49,19 @@ def airtable_write():
return airtable


class TestAbout():

def test_get_about_info(self):
from airtable.__version__ import (__version__,
__name__,
__description__,
__url__,
__author__,
__license__,
__copyright__,
)
assert __version__

class TestAuth():

def test_authorization_scheme(self):
Expand Down Expand Up @@ -129,6 +143,13 @@ def test_get_bad_param(self, airtable_read):
airtable_read.get_all(view='ViewOne', bad_param=True)
assert 'invalid param keyword' in str(excinfo.value).lower()

def test_get_bad_request_decoded_msg(self, airtable_read):
with pytest.raises(HTTPError) as excinfo:
airtable_read.get_all(view='ViewOne', sort=['NON_EXISTING'], fields=['X'])
assert 'Unprocessable Entity for url(decoded)' in str(excinfo.value).lower()
assert 'sort[0]' in str(excinfo.value).lower()
assert 'fields[]=' in str(excinfo.value).lower()

def test_get_all_fields_single(self, airtable_read):
records = airtable_read.get_all(view='ViewAll', maxRecords=1,
fields=['COLUMN_UPDATE'])
Expand Down

0 comments on commit bcca1fc

Please sign in to comment.