enewe101 / digidemo

digital democracy engine
1 stars 0 forks source link

Discussion test #44

Closed mlhuish closed 9 years ago

mlhuish commented 9 years ago

I wanted to explore this pull request feature of git. Testing the test. I was running into errors with my database, so I'm not entirely sure this is functioning properly. Can you take a glance over this @enewe101 ?

enewe101 commented 9 years ago

Sure thing. Ill check it out first thing tomorrow! On Feb 17, 2015 12:19 AM, "Ange" notifications@github.com wrote:

I wanted to explore this pull request feature of git. Testing the test. I was running into errors with my database, so I'm not entirely sure this is functioning properly. Can you take a glance over this

@enewe101 https://github.com/enewe101 ?

You can view, comment on, or merge this pull request online at:

https://github.com/enewe101/digidemo/pull/44 Commit Summary

  • start writing a test case for adding Discussions
  • added id tags to test.py add_disscussion_test
  • allow viewing full petition text
  • updated test.py to include testing the addition of discussion items. There may be an error with testing the database or it may just be my machine
  • Merge branch 'discussion_test' of https://github.com/enewe101/digidemo into discussion_test

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/enewe101/digidemo/pull/44.

enewe101 commented 9 years ago

Hey A, nice work -- I looked through the code. So there was one prob that was my mistake. In the code checking the database (if you pull latest, on line 828), I accidentally spelled the name of a field "proposal" which should have been "target".

I decided to change slightly how the id's for the discussion listing are working. Rather than base the id on the discussion's title, I used it's pk (= primary key), which is an identifier provided by the database, and is guaranteed to be unique. The trouble with using the title as the id is that it's not guaranteed to be unique. As for the use of ids in DiscussionArieView (in post_area.html), they were right on.

One last tweek was to change the line that tests to see if the discussion displays the right title / text. Before, I had made the test based on title_selenium_found == title_expected. But the problem is that, when data is taken from the database and put into a template, some whitespace (newlines and tabs) ends up mixed in with the inserted text. But, the function text_is_similar(title_selenium_found, title_expected) tests whether the two supplied strings are the same without considering differences in whitespace. That function is defined in test.py itself, and will definitely come in handy in many tests.

I didn't touch the second test at all -- it's passing, and looks great. Nice one!!

You can have a look at the small changes I made to the first test. All tests are passing. This has been merged into master. This issue is duuuuhn!

enewe101 commented 9 years ago

Huh, don't know why it says "unmerged commits". Maybe because I merged manually. This is merged.

mlhuish commented 9 years ago

The primary key! Of course! I was concerned about what I was doing before with the potentially ununique ids. This is great great. I'm going to familiarize myself with the database and mysql-python interfacing now. Thanks for polishing off these files!