def includes_init_kwargs_host_value(self): call = ConnectionCall( fabric.Task(body=_dummy), init_kwargs=dict(host="host", user="******"), ) # TODO: worth using some subset of real Connection repr() in here? # For now, just stick with hostname. expected = ( "<ConnectionCall '_dummy', args: (), kwargs: {}, host='host'>" ) # noqa assert str(call) == expected
def inherits_regular_kwargs(self): t = fabric.Task(_dummy) call = ConnectionCall( task=t, called_as="meh", args=["5"], kwargs={"kwarg": "val"}, init_kwargs={}, # whatever ) assert call.task is t assert call.called_as == "meh" assert call.args == ["5"] assert call.kwargs["kwarg"] == "val"
def accepts_Invoke_level_init_kwargs(self): # Arbitrarily selected list of invoke-level kwargs... def body(c, parts): "I am a docstring" pass t = fabric.Task( body=body, name="dadbod", aliases=["heavenly", "check", "shop"], default=True, help={"parts": "See: the sum of"}, iterable=["parts"], ) assert t.body is body assert t.__doc__ == "I am a docstring" assert t.name == "dadbod" assert "heavenly" in t.aliases assert t.is_default assert "parts" in t.help assert "parts" in t.iterable
def allows_hosts_kwarg(self): # NOTE: most tests are below, in @task tests assert fabric.Task(Mock(), hosts=["user@host"]).hosts == ["user@host"]
def extends_with_init_kwargs_kwarg(self): call = ConnectionCall( task=fabric.Task(_dummy), init_kwargs={"host": "server", "port": 2222}, ) assert call.init_kwargs["port"] == 2222