def execute(self, context):
     ctx = {}
     args = [1, this.request]
     kwargs = {}
     attach_request_meta(ctx, *args, **kwargs)
     assert ctx['url'] == URL
     assert ctx['domain'] == DOMAIN
     assert ctx['operator'] == operator
 def test_blacklisted(self):
     with patch('airflow_metrics.airflow_metrics.patch_requests.BLACKLIST',
                {DOMAIN}):
         ctx = {}
         args = [1, self.request]
         kwargs = {}
         attach_request_meta(ctx, *args, **kwargs)
         assert 'domain' not in ctx
 def test_not_called_by_operator(self):
     ctx = {}
     args = [1, self.request]
     kwargs = {}
     attach_request_meta(ctx, *args, **kwargs)
     assert 'operator' not in ctx
 def test_not_prepared_request(self):
     ctx = {}
     args = [1, 2]
     kwargs = {}
     attach_request_meta(ctx, *args, **kwargs)
     assert 'url' not in ctx
 def test_no_url(self):
     ctx = {}
     args = []
     kwargs = {}
     attach_request_meta(ctx, *args, **kwargs)
     assert 'url' not in ctx