2017-11-27 04:22:03 +01:00
|
|
|
import pytest
|
2017-11-27 02:25:33 +01:00
|
|
|
from datetime import datetime
|
|
|
|
|
2017-11-27 20:42:54 +01:00
|
|
|
|
2017-11-27 02:25:33 +01:00
|
|
|
@pytest.mark.vcr()
|
|
|
|
def test_id_hook(status):
|
|
|
|
assert isinstance(status['id'], int)
|
|
|
|
|
2017-11-27 20:42:54 +01:00
|
|
|
|
2017-11-27 02:25:33 +01:00
|
|
|
@pytest.mark.vcr()
|
2017-11-27 14:35:02 +01:00
|
|
|
def test_id_hook_in_reply_to(api, status):
|
|
|
|
reply = api.status_post('Reply!', in_reply_to_id=status['id'])
|
2017-11-27 02:25:33 +01:00
|
|
|
try:
|
|
|
|
assert isinstance(reply['in_reply_to_id'], int)
|
|
|
|
assert isinstance(reply['in_reply_to_account_id'], int)
|
|
|
|
finally:
|
2017-11-27 14:35:02 +01:00
|
|
|
api.status_delete(reply['id'])
|
2017-11-27 02:25:33 +01:00
|
|
|
|
2017-11-27 20:42:54 +01:00
|
|
|
|
2017-11-27 02:25:33 +01:00
|
|
|
@pytest.mark.vcr()
|
2017-11-27 14:35:02 +01:00
|
|
|
def test_id_hook_within_reblog(api, status):
|
|
|
|
reblog = api.status_reblog(status['id'])
|
2017-11-27 02:25:33 +01:00
|
|
|
try:
|
|
|
|
assert isinstance(reblog['reblog']['id'], int)
|
|
|
|
finally:
|
2017-11-27 14:35:02 +01:00
|
|
|
api.status_delete(reblog['id'])
|
2017-11-27 02:25:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.vcr()
|
|
|
|
def test_date_hook(status):
|
|
|
|
assert isinstance(status['created_at'], datetime)
|
2018-05-06 02:50:54 +02:00
|
|
|
|
|
|
|
@pytest.mark.vcr()
|
|
|
|
def test_attribute_access(status):
|
|
|
|
assert status.id != None
|
|
|
|
with pytest.raises(AttributeError):
|
|
|
|
status.id = 420
|
|
|
|
|