8000 Fixing Some Nits in Tests (#39) · carsongee/firebase-admin-python@35a6174 · GitHub
[go: up one dir, main page]

Skip to content

Commit 35a6174

Browse files
authored
Fixing Some Nits in Tests (firebase#39)
* Adding integration tests to the linter. Minor update to a db integration test. * Fixing linter script * Adding the unused-argument check back
1 parent 5743368 commit 35a6174

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

integration/test_db.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def testref(update_rules):
4949
Returns:
5050
Reference: A reference to the test dinosaur database.
5151
"""
52+
del update_rules
5253
ref = db.reference('_adminsdk/python/dinodb')
5354
ref.set(testdata())
5455
return ref
@@ -138,10 +139,15 @@ def test_update_children_with_existing_values(self, testref):
138139

139140
def test_update_nested_children(self, testref):
140141
python = testref.parent
141-
ref = python.child('users').push({'name' : 'Edward Cope', 'since' : 1800})
142-
nested_key = '{0}/since'.format(ref.key)
143-
python.child('users').update({nested_key: 1840})
144-
assert ref.get() == {'name' : 'Edward Cope', 'since' : 1840}
142+
edward = python.child('users').push({'name' : 'Edward Cope', 'since' : 1800})
143+
jack = python.child('users').push({'name' : 'Jack Horner', 'since' : 1940})
144+
delta = {
145+
'{0}/since'.format(edward.key) : 1840,
146+
'{0}/since'.format(jack.key) : 1946
147+
}
148+
python.child('users').update(delta)
149+
assert edward.get() == {'name' : 'Edward Cope', 'since' : 1840}
150+
assert jack.get() == {'name' : 'Jack Horner', 'since' : 1946}
145151

146152
def test_delete(self, testref):
147153
python = testref.parent
@@ -233,6 +239,7 @@ def test_filter_by_value(self, testref):
233239

234240
@pytest.fixture(scope='module')
235241
def override_app(request, update_rules):
242+
del update_rules
236243
cred, project_id = conftest.integration_conf(request)
237244
ops = {
238245
'databaseURL' : 'https://{0}.firebaseio.com'.format(project_id),
@@ -244,6 +251,7 @@ def override_app(request, update_rules):
244251

245252
@pytest.fixture(scope='module')
246253
def none_override_app(request, update_rules):
254+
del update_rules
247255
cred, project_id = conftest.integration_conf(request)
248256
ops = {
249257
'databaseURL' : 'https://{0}.firebaseio.com'.format(project_id),

lint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ if [[ "$CHECK_ALL" = true ]]
4848
then
4949
lintAllFiles "firebase_admin" ""
5050
lintAllFiles "tests" "$SKIP_FOR_TESTS"
51+
lintAllFiles "integration" "$SKIP_FOR_TESTS"
5152
else
5253
lintChangedFiles "firebase_admin" ""
5354
lintChangedFiles "tests" "$SKIP_FOR_TESTS"
55+
lintChangedFiles "integration" "$SKIP_FOR_TESTS"
5456
fi

tests/test_credentials.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class TestApplicationDefault(object):
8181

8282
@pytest.mark.parametrize('app_default', [testutils.resource_filename('service_account.json')],
8383
indirect=True)
84-
def test_init(self, app_default): # pylint: disable=unused-argument
84+
def test_init(self, app_default):
85+
del app_default
8586
credential = credentials.ApplicationDefault()
8687
assert credential.project_id == 'mock-project-id'
8788

@@ -98,7 +99,8 @@ def test_init(self, app_default): # pylint: disable=unused-argument
9899

99100
@pytest.mark.parametrize('app_default', [testutils.resource_filename('non_existing.json')],
100101
indirect=True)
101-
def test_nonexisting_path(self, app_default): # pylint: disable=unused-argument
102+
def test_nonexisting_path(self, app_default):
103+
del app_default
102104
with pytest.raises(IOError):
103105
credentials.ApplicationDefault()
104106

tests/test_db.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def __init__(self, data, status, recorder):
3636
self._status = status
3737
self._recorder = recorder
3838

39-
def send(self, request, **kwargs): # pylint: disable=unused-argument
39+
def send(self, request, **kwargs):
40+
del kwargs
4041
self._recorder.append(request)
4142
resp = models.Response()
4243
resp.url = request.url

0 commit comments

Comments
 (0)
0