Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cli for description #259

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

AnubhaAgrawal
Copy link
Contributor

Solve #240 for description

Copy link
Member

@WhyNotHugo WhyNotHugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is great so far. Please add unit tests for these. 🙂

Copy link
Member

@WhyNotHugo WhyNotHugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far. Please also add another test case for editing the description too.

Thanks! 🙂

@AnubhaAgrawal
Copy link
Contributor Author

Please tell me that there is any problem in test_edit_description.

Copy link
Member

@WhyNotHugo WhyNotHugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Just a few minor tweaks.

def test_edit_description(runner, todos, todo_factory):
todo_factory(summary='harhar\n', description='Parnidi')

result = runner.invoke(cli, ['edit', '1', '--description', 'Parnidi'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When editing the todo, set the description to something different than the original value. Otherwise it's unclear if the edit did anything or not.



def test_edit_description(runner, todos, todo_factory):
todo_factory(summary='harhar\n', description='Parnidi')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the \n here.

@@ -652,6 +653,9 @@ def todos(self, lists=(), priority=None, location='', category='', grep='',
if priority:
extra_where.append('AND PRIORITY > 0 AND PRIORITY <= ?')
params.append('{}'.format(priority))
if description:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, also, no tests seem to cover this new filter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think this filter does not do anything. so, I remove it.

@@ -466,6 +468,8 @@ def move(ctx, list, ids):
@cli.command()
@pass_ctx
@click.argument('lists', nargs=-1, callback=_validate_lists_param)
@click.option('--description',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you deleted the implementation for this flag, the flag should be removed too.

Note that that implementation was not wrong; just missing tests though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't understand which tests are missing.
And if I remove the flag then also it works correctly then why that implementation was not wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag was used here. By deleting that bit of code, this flag is now unused and ignored.

My initial comment on that related bit of code was that there were no tests for it (though the code itself seemed fine). Basically, that would be a test that uses runner with 'list', '--description'.

You can either remove the flag (now unused), or undelete that code and add tests for it (I'm very much prefer the latter, of course. 🙂 ).

@AnubhaAgrawal
Copy link
Contributor Author

AnubhaAgrawal commented Jun 21, 2017 via email

Copy link
Member

@WhyNotHugo WhyNotHugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Just one final improvement and we're good to go.

assert 'Kimple' in result.output


def test_filter_description(runner, create):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also a second todo to this test case that is NOT included in the result (eg: one that has a descripcion that doesn't contain 'Kimple'). That way, we can make sure we're not showing todos that don't match the filtering criteria.

)
result = runner.invoke(cli, ['list'])

assert 'Shubik' in result.output
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, assert that the other todo is not in result.output. You'll want to give them different summaries to tell them apart.

@AnubhaAgrawal
Copy link
Contributor Author

can you please tell me that is any other change is required??

@WhyNotHugo
Copy link
Member

Looks like this comment hasn't been addressed yet.

Base automatically changed from master to main March 9, 2021 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants