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

Global topics #18

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Global topics #18

wants to merge 17 commits into from

Conversation

GregsCode12
Copy link

Added tables topics and posts. Added functionality to fetch global topics.

@MasterMind2k
Copy link
Member

Nice, will look into it soon as I get some time.

At quick glance, it looks really nice.

Copy link
Member

@MasterMind2k MasterMind2k left a comment

Choose a reason for hiding this comment

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

Please add requested changes.

After last review, please squash all commits into one (will remind you after second review).

Looks great!

tests/fixtures/postgres/global_topics_test_data.sql Outdated Show resolved Hide resolved
tests/integration/base.py Outdated Show resolved Hide resolved
tests/integration/base.py Outdated Show resolved Hide resolved
tests/integration/test_extension.py Outdated Show resolved Hide resolved
tests/integration/test_extension.py Show resolved Hide resolved
@GregsCode12
Copy link
Author

GregsCode12 commented May 23, 2019

Changes commited, should I make another pull request?

Nevermind, saw that changes are visible :)

Copy link
Member

@MasterMind2k MasterMind2k left a comment

Choose a reason for hiding this comment

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

Good progress. Put some additional comments.

I apologize I wasn't able to review this before start of the weekend :(.

topic = self.app.phpbb3.fetch_global_topics(
skip=skip,
limit=1,
forum_id=0)
self.assertEqual((skip, topic), expected_topics[skip])
if skip > 3:
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering what this was for.

You can compare lists without any problems.

So, if database has positive and negative items, you only compare if actual result is equal to expected result (only positive).

Copy link
Author

Choose a reason for hiding this comment

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

Oh, must have misunderstood the the positive vs. negative tests. All tests after index 3 are expected to not be equal.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I see that.

What I would like to see is, that this would be more explicitly be seen from code. This does its job, but I needed cca 30 minutes longer to get the point.

By properly separating tests and naming them, you can really make the tests easy readable.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I see what you mean, will submit new changes soon.

",topic_first_poster_name"
",topic_first_post_id"
",topic_type"
") values ("
Copy link
Member

Choose a reason for hiding this comment

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

Whitespace in strings are missing (simulating you would be writing into a file).

Also, I see you could congest each row into one line. While keeping field list with each column in its own line (for readability).

Example:

        "insert into phpbb_topics ("
        "  topic_id"
        "  ,forum_id"
        "  ,topic_title"
        "  ,topic_time"
        "  ,topic_first_poster_name"
        "  ,topic_first_post_id"
        "  ,topic_type"
        ") values"
        "(0,0,'topic title 0',10",'name'",0,3)"
        ", (1, 0, topic title 1', 13, 'second poster', 1, 3)"
        ", (2, 0, 'topic title 2', 200, 'post it', 2, 3)"
        ...

",999"
",'inserted into table, expecting different type'"
",3"
",3"
Copy link
Member

Choose a reason for hiding this comment

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

Should this number be something else (topic_type)?

I see in your dataset you have only topic_type 3.

Copy link
Author

Choose a reason for hiding this comment

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

I have set up one example where topic_type is different from 3. But the select expression for global topics has a where clause with a condition that topic_type = 3. So I think it would make sense to have most of examples fulfilling this condition.

" (1,'druga tema','blabla'),"
" (2,'tretja tema','blablabla'),"
" (3,'tretja tema','bla krat 4')"
" insert into phpbb_posts ("
Copy link
Member

Choose a reason for hiding this comment

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

Be careful!

You have INNER JOIN in the query. Which means other topics won't show up, because their posts do not exist!

Add posts before changing your tests to see if it will break your tests.

Copy link
Author

Choose a reason for hiding this comment

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

Posts have been added in the next commit.

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