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

Title Search #138

Closed
wants to merge 5 commits into from
Closed

Title Search #138

wants to merge 5 commits into from

Conversation

qwo
Copy link
Member

@qwo qwo commented Feb 8, 2017

WIP; Addresses #104

  • Test
  • Screenshot
  • AUTHORS.md entry
  • CHANGES.md entry
  • Documentation

URL bar = http://localhost:8000/search/?q=google
screen shot 2017-02-07 at 11 26 56 pm

@qwo
Copy link
Member Author

qwo commented Feb 8, 2017

hi @punchagan, had a question about testing this;

I see there's a helper method create_posts available in .utils. Should I use the helper to generate a few posts with a specific post name for the test or would you suggest a different way to add a test for this.

I could see manually creating post titles and then counting the ones returned from the search as a viable test. If that's adequate I can try that.

@qwo
Copy link
Member Author

qwo commented Feb 8, 2017

Update:

I wrote a small test using the method I mentioned but it looks like maybe the test runner uses SQLite3 for the runner? I'm using a postgres full text search so I'm getting a SQL error when I run my tests which would make sense. What would you recommend?

  File "/usr/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute
    return Database.Cursor.execute(self, query, params)
OperationalError: unrecognized token: "@"

@punchagan
Copy link
Member

@stanzheng This is good work. 👍 Thank you for your time, and the PR.

I could see manually creating post titles and then counting the ones returned from the search as a viable test. If that's adequate I can try that.

That would be good for a start, I think. Just testing that a search results the right results, and an invalid search doesn't return results.

I wrote a small test using the method I mentioned but it looks like maybe the test runner uses SQLite3 for the runner? I'm using a postgres full text search so I'm getting a SQL error when I run my tests which would make sense. What would you recommend?

I think we should switch the test runner to run on postgres. I probably started using sqlite to make testing faster, because some of them can take a while. The other option could be to use Postgres only for these tests. I won't be able to look into this until early next week. So, if you'd like to, explore one of the options and see how it goes?

@qwo
Copy link
Member Author

qwo commented Feb 11, 2017

@punchagan thank you for weighing back in; It was end of batch this week so got wrapped up in a new project and going home.

I would love your help on putting the tests and postgres config; I'm not that experienced with Django would enjoy your help with reviewing the the code and making the config changes so all the past tests don't break 😄.

@punchagan
Copy link
Member

@stanzheng Looks like you forgot to commit search.html and I'm unable to test this. 😄

@qwo
Copy link
Member Author

qwo commented Feb 18, 2017

Ah sorry @punchagan! i was doing some weird cherry picking because I needed #137 to actively develop on my machine.

Let me make sure search.html but if you could merge that PR if its cool too!

@qwo
Copy link
Member Author

qwo commented Feb 18, 2017

ended up in a bit of git-fusion with cherry-picking my dev branch that I did all the work ontop of. I ended up just pushing everything including my other branch #137

@qwo
Copy link
Member Author

qwo commented Feb 18, 2017

@punchagan I pushed up all of my latest; I'm unsure how the test database blog titles generate their titles to search for them. It looks like Lorem Ipsum but unsure if it's the same each time.

ERROR: test_crawling_posts (home.tests.test_crawlposts.CrawlPostsTestCase)
FAIL: test_should_not_edit_blog_not_logged_in (home.tests.test_views.EditBlogViewTestCase)

@punchagan
Copy link
Member

Thanks for your work on this @stanzheng! I've merged your code in a separate PR along with a single test. Feel free to add more tests, or work on further improvements. I would be happy to help!

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