def test_vary_origins_called(self): cors = CORS(allow_all_origins=True, allow_credentials_origins_list=['test.com']) cors._set_vary_origin = mock.Mock() origin = self.get_rand_str() headers = [('origin', origin)] self.simulate_cors_request(cors, headers=headers, preflight=False) cors._set_vary_origin.assert_called_once_with(self.resource.resp)
def test_set_very_origin(self): fake_resp = mock.MagicMock() cors = CORS() cors._set_vary_origin(fake_resp) fake_resp.append_header.assert_called_once_with('vary', 'origin')