def test_get_collection(self, get): get.return_value = self.SINGLE_ADD_RESPONSE # Assert that the mocked get function is called the way we expect. keen.get_collection("foo") # Check that the URL is generated correctly self.assertEqual("https://api.keen.io/3.0/projects/1k4jb23kjbkjkjsd/events/foo", get.call_args[0][0]) # Check that the master_key is in the Authorization header self.assertTrue(keen.master_key in get.call_args[1]["headers"]["Authorization"])