steem-python icon indicating copy to clipboard operation
steem-python copied to clipboard

Testing with `no_broadcast=True` does not work with a `Post`

Open SmokinCaterpillar opened this issue 7 years ago • 1 comments

Hi, the no_broadcast=True option does not work with a Post. I figured this out by making an unwanted comment on steemit by accident :-D

This becomes immediately clear if we look into the constructors of Steem as well as Post.

In the Steem constructor the no_broadcast option is directly passed to the Commit:

def __init__(self, nodes=None, no_broadcast=False, **kwargs):
    self.steemd = Steemd(
        nodes=nodes,
        **kwargs
    )
    self.commit = Commit(
        steemd_instance=self.steemd,
        no_broadcast=no_broadcast,
        **kwargs
    )

However, the Post constructor does not know about no_broadcast and creates a regular Commit:

def __init__(self, post, steemd_instance=None):
    self.steemd = steemd_instance or shared_steemd_instance()
    self.commit = Commit(steemd_instance=self.steemd)
    ...

Why does the Post need to create a new Commit object? Could it simply use the commit of the Steem object? Alternatively, the Post constructor could also simply take no_broadcast as an argument. Let me know which solution you prefer and I'll make a pull request.

SmokinCaterpillar avatar Feb 18 '18 21:02 SmokinCaterpillar

I stumbled over this again, have you made up your mind what solution you prefer? I'll do a PR in this case :-)

SmokinCaterpillar avatar Jul 11 '18 17:07 SmokinCaterpillar