Skip to content

Conversation

@oalders
Copy link
Contributor

@oalders oalders commented Jun 26, 2017

No description provided.

RFC 3339 date-time.
:type: str | None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the response models. There are not models for the request. Instead we do validation on a dict:

Required('device'): {

This code should be removed.

self.assertEqual(id, device.id)
self.assertEqual(last_seen, device.last_seen)
self.assertEqual(session_age, device.session_age)
self.assertEqual(session_id, device.session_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be replaced with tests in test_validation.py. Also, add the new fields to https://github.com/maxmind/minfraud-api-python/tree/9b15e69971bd27b9a5dc4282df78de5147ab0504/tests/data.

@oalders oalders force-pushed the oalders/device-and-session-inputs branch from bfcb950 to 78687a7 Compare June 28, 2017 21:42
HISTORY.rst Outdated

* Added the following new values to the ``/payment/processor`` validation:
``ebs``, ``hipay``, and ``lemon_way``.
* Added the following new values to the ``/device`` validation:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is phrased a bit weird. Maybe we should at least say "input" values or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d36a0bc

HISTORY.rst Outdated
``ebs``, ``hipay``, and ``lemon_way``.
* Added the following new values to the ``/device`` validation:
``session_age`` and ``session_id``.
* Added the following new values to the ``/email`` validation:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong. We added the attribute to the Email response model or, alternatively, we added support for the /email/first_seen output. We didn't do anything related to validation for this output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d36a0bc

'accept_language': _unicode_or_printable_ascii,
Required('ip_address'): _ip_address,
'user_agent': _unicode_or_printable_ascii
'session_age': float,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this Range(min=0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6e2bf16

id = 'b643d445-18b2-4b9d-bad4-c9c4366e402a'
last_seen = '2016-06-08T14:16:38Z'
device = Device({'confidence': 99, 'id': id, 'last_seen': last_seen})
device = Device({'confidence': 99, 'id': id, 'last_seen': last_seen })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run the most recent version of yapf to tidy the code.


def test_session_age(self):
self.check_transaction({'device': {'ip_address': '4.4.4.4', 'session_age': 3600.5}})
for invalid in (3600, 0, -1):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are 3600 and 0 invalid? Let's fix that so they aren't and maybe add a test for a non-numeric value too, e.g., 'foo'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess those weren't valid floats. Fixed in 6e2bf16

@oschwald
Copy link
Member

Oh, could we also add these to the example in the README.rst?

@oalders
Copy link
Contributor Author

oalders commented Jun 29, 2017

Added device inputs to README.rst

@oalders oalders force-pushed the oalders/device-and-session-inputs branch from a7e1fbf to bab7dd3 Compare June 29, 2017 20:45
@oschwald oschwald merged commit d9f7125 into master Jun 30, 2017
@oschwald oschwald deleted the oalders/device-and-session-inputs branch June 30, 2017 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants