Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_page(self):
telegraph = Telegraph()
response = telegraph.get_page('Hey-01-17-2', return_html=False)
self.assertEqual(
response['content'],
[{'tag': 'p', 'children': ['Hello, world!']}]
)
def test_get_page_html(self):
telegraph = Telegraph()
response = telegraph.get_page('Hey-01-17-2')
self.assertEqual(response['content'], '<p>Hello, world!</p>')
def test_get_page_without_content(self):
telegraph = Telegraph()
response = telegraph.get_page('Hey-01-17-2', return_content=False)
self.assertTrue('content' not in response)
def test_flow(self):
telegraph = Telegraph()
response = telegraph.create_account(
short_name='python telegraph',
author_name='Python Telegraph API wrapper',
author_url='https://github.com/python273/telegraph'
)
self.assertTrue('access_token' in response)
self.assertTrue('auth_url' in response)
response = telegraph.get_account_info()
self.assertEqual(response['short_name'], 'python telegraph')
response = telegraph.edit_account_info(
short_name='Python Telegraph Wrapper'
)
self.assertEqual(response['short_name'], 'Python Telegraph Wrapper')