Esempio n. 1
0
 def test_user_agent_with_no_key(self):
     from tootwi import API
     user_agent_key = 'User-Agent' # default expected
     tootwi_own_val = 'tootwi/'
     api = API()
     invocation = api.invoke(FAKE_OPERATION)
     self.assertIn(user_agent_key, invocation.headers)
     self.assertIn(tootwi_own_val, invocation.headers[user_agent_key])
Esempio n. 2
0
 def common_user_agent_test(self, user_agent_key):
     from tootwi import API
     user_agent_val = 'test-user-agent/1.2.3'
     tootwi_own_val = 'tootwi/'
     api = API(headers={ user_agent_key: user_agent_val })
     invocation = api.invoke(FAKE_OPERATION)
     self.assertIn(user_agent_key, invocation.headers)
     self.assertIn(user_agent_val, invocation.headers[user_agent_key])
     self.assertIn(tootwi_own_val, invocation.headers[user_agent_key])
Esempio n. 3
0
 def test_headers_cleaned_from_nones(self):
     from tootwi import API
     api = API(headers={'empty':None})
     invocation = api.invoke(FAKE_OPERATION)
     self.assertNotIn('empty', invocation.headers)
Esempio n. 4
0
 def test_headers_go_to_invocation(self):
     from tootwi import API
     api = API(headers={'hello':'world', 'empty':''})
     invocation = api.invoke(FAKE_OPERATION)
     self.assertDictContainsSubset({'hello':'world', 'empty':''}, invocation.headers)