Skip to content

Commit

Permalink
Update api 1.12 (#49)
Browse files Browse the repository at this point in the history
* Updating to 0.1.4

Changes:
- default create_on{ha,junk} fixed according to API
- added licence type to the create method of sources
- added old_password argument to password chagnge method

* Fixing tests

* Removed deprecated entries module

* Removed tests of entries

* Updated changelogˆ

* Doing version the right way

* Bump version: 0.1.3 → 0.1.4

* Removed Python 3.4 support

* Added licence choices

Changes:
- kinda enum class that encapsulates all available licences

* Fixing licences types

* Removing entries from examples and client

* Removing entries from docs

* Revert "Removing entries from examples and client"

This reverts commit 87f98a1

* Revert "Removed deprecated entries module"

This reverts commit 43b8795

* Removed records

* Returning entries docs

* Bump version: 0.1.4 → 0.1.5

* Returning entries in client

* Revert "Removed deprecated entries module"

This reverts commit 43b8795

* Removed docs for records

* Revert "Removing entries from docs"

This reverts commit 5fe7db5
  • Loading branch information
gasabr authored and Lev Rubel committed Jul 1, 2019
1 parent 259e4b4 commit 9f3f07f
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 101 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
History
=================

0.1.5 (2019-07-01)
------------------

* Returned entries module
* Removed records module

0.1.4 (2019-06-20)
------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
identixone.api.records package
identixone.api.entries package
==============================

Subpackages
-----------

.. toctree::

identixone.api.records.v1
identixone.api.entries.v1

Module contents
---------------

.. automodule:: identixone.api.records
.. automodule:: identixone.api.entries
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
identixone.api.records.v1 package
identixone.api.entries.v1 package
=================================

Submodules
----------

identixone.api.records.v1.records module
identixone.api.entries.v1.entries module
----------------------------------------

.. automodule:: identixone.api.records.v1.records
.. automodule:: identixone.api.entries.v1.entries
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -16,7 +16,7 @@ identixone.api.records.v1.records module
Module contents
---------------

.. automodule:: identixone.api.records.v1
.. automodule:: identixone.api.entries.v1
:members:
:undoc-members:
:show-inheritance:
26 changes: 0 additions & 26 deletions examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
client = Client(token=token, version=1)


def list_records():
# DEPRECATED
period_start = datetime.datetime(year=2019, month=1, day=13, hour=19,
minute=20, second=1)
period_end = datetime.datetime(year=2019, month=1, day=22, hour=19,
minute=20, second=1)
r = client.records.list(new=True, nm=False, junk=False, exact=False,
ha=False, det=False, period_start=period_start,
period_end=period_end)
print(r.json())


def sources_list():
r = client.sources.list()
print(r.json())
Expand Down Expand Up @@ -133,20 +121,6 @@ def bulk_delete_temporary_tokens():
print(r.status_code)


def idxid_records():
# DEPRECATED
idxid = 'idxid'
r = client.records.get(idxid=idxid)
print(r.json())


def entry_delete():
# DEPRECATED
entry_id = 1
r = client.records.entry_delete(entry_id)
print(r.status_code)


def auth_create_token():
r = client.auth.create_token()
print(r.json())
Expand Down
2 changes: 1 addition & 1 deletion identixone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = """Identix One"""
__email__ = 'dev@identix.one'
__version__ = '0.1.4'
__version__ = '0.1.5'
8 changes: 4 additions & 4 deletions identixone/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ def persons(self):
return cls(self.http_client)

@property
def records(self):
cls = self.dynamic_import('identixone.api.records', 'Records')
def sources(self):
cls = self.dynamic_import('identixone.api.sources', 'Sources')
return cls(self.http_client)

@property
def sources(self):
cls = self.dynamic_import('identixone.api.sources', 'Sources')
def entries(self):
cls = self.dynamic_import('identixone.api.entries', 'Entries')
return cls(self.http_client)

@property
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions identixone/api/entries/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from identixone.api.entries.v1.entries import Entries

__all__ = [Entries]
16 changes: 16 additions & 0 deletions identixone/api/entries/v1/entries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Entries(object):

def __init__(self, http_client):
self.http_client = http_client

def list(self, **kwargs):
return self.http_client.get('v1/entries/', params=kwargs)

def delete(self, id):
return self.http_client.delete('v1/entries/{}/'.format(id))

def stats_idxid(self, idxid):
return self.http_client.get('v1/entries/stats/idxid/{}/'.format(idxid))

def stats_sources(self, **kwargs):
return self.http_client.get('v1/entries/stats/sources/', params=kwargs)
3 changes: 0 additions & 3 deletions identixone/api/records/v1/__init__.py

This file was deleted.

30 changes: 0 additions & 30 deletions identixone/api/records/v1/records.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.4
current_version = 0.1.5
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/identixone/identixone-python',
version='0.1.4',
version='0.1.5',
zip_safe=False,
)
44 changes: 16 additions & 28 deletions tests/api/test_api_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,54 +214,42 @@ def test_persons_entry(self, mocked_send):
self.assertEqual(response.status_code, status_code)


class TestAPIRecordsModule(TestAPIModule):
class TestAPIEntriesModule(TestAPIModule):

@patch.object(Session, 'send')
def test_list_records(self, mocked_send):
def test_list_entries(self, mocked_send):
status_code = 200
resp_body = {'key': 'value'}
mocked_send.return_value = self.response(resp_body, status_code)

with warnings.catch_warnings(record=True) as w:
response = self.client.records.list(
new=True, junk=False, ha=False, qty=10)

assert len(w) == 1
assert issubclass(w[-1].category, FutureWarning)
assert 'deprecated' in str(w[-1].message).lower()

response = self.client.entries.list(
conf='new,exact,ha', limit=10)
self.assertEqual(response.json(), resp_body)
self.assertEqual(response.status_code, status_code)

@patch.object(Session, 'send')
def test_get_records(self, mocked_send):
def test_stats_idxid(self, mocked_send):
status_code = 200
resp_body = {'key': 'value'}
mocked_send.return_value = self.response(resp_body, status_code)

with warnings.catch_warnings(record=True) as w:
response = self.client.records.get(idxid='1')

assert len(w) == 1
assert issubclass(w[-1].category, FutureWarning)
assert 'deprecated' in str(w[-1].message).lower()

response = self.client.entries.stats_idxid(idxid='1')
self.assertEqual(response.json(), resp_body)
self.assertEqual(response.status_code, status_code)

@patch.object(Session, 'send')
def test_entry_delete_records(self, mocked_send):
def test_stats_sources(self, mocked_send):
status_code = 200
resp_body = {'key': 'value'}
mocked_send.return_value = self.response(resp_body, status_code)
response = self.client.entries.stats_sources(conf='new', limit=1000)
self.assertEqual(response.json(), resp_body)
self.assertEqual(response.status_code, status_code)

with warnings.catch_warnings(record=True) as w:
response = self.client.records.entry_delete(entry_id=1)

assert len(w) == 1
assert issubclass(w[-1].category, FutureWarning)
assert 'deprecated' in str(w[-1].message).lower()

@patch.object(Session, 'send')
def test_delete_entry(self, mocked_send):
status_code = 204
resp_body = None
mocked_send.return_value = self.response(resp_body, status_code)
response = self.client.entries.delete(id=1)
self.assertEqual(response.json(), resp_body)
self.assertEqual(response.status_code, status_code)

Expand Down

0 comments on commit 9f3f07f

Please sign in to comment.