-
Notifications
You must be signed in to change notification settings - Fork 2
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
Need Tests #5
Comments
I just pushed a commit to my fork adding some new functions. Next I'm going to write some tests but I was wondering what exactly you were looking for. For example, to validate most of functions requires an internet connection - meaning tests (as of now) would fail if for some reason it was being installed on an isolated box or if Reddit was down. Is this acceptable behavior? There's also the problem with the module requiring a login to provide any functionality - even functions which do not require a login (getting front page posts for instance). Also, testing methods which require a login would need a dedicated account - an account whose login info would be plaintext in the test file and therefore open to vandalism (someone changing the password and making the tests fail). Anywho, I'd like your thoughts on the matter before writing anything substantial to the test file. |
@dookerdo holy crap. I can't believe you sent this a month ago... I got the e-mail and have been meaning to reply to you... guess work really has been keeping my busy. Sorry for the delay. (Not to mention you're asking the really hard hitting questions that I've had some trouble coming up with answers to (and largely the reason for the absence of test ;) myself)
I think so. Since the module can't be used without an internet connection anyway, and all of the automated testing infrastructure provided by the Perl community has an internet connection, I think it is a safe requirement.
I've thought about this quite a bit too. I initially wrote the module to help me automate posting, but quickly needed more functions / features, hence the requirement to login before performing any action. If we wrote it such that you only had to login for actions requiring login, (post, upvote, downvote, comment) a) what's left (pull threads, search, ?) and b) do you think it would make the module more versatile and c) do you think it would make maintenance any more difficult? This may be a fundamental change, but I think it may be worth it.
This has really been my stumbling block. How do you automate testing against an API that requires authentication? I really don't know the answer and am open to suggestions. One thing I have seen, is the test script acts like a dummy API and can handle the API calls... the problem here is two fold, first the API is ever-changing, so just because our tests pass, doesn't necessarily mean the Module will work against the live API, and second, that would require implementing our own back end and I'm not so certain our results we necessarily be consistent with what we can pull from the API (does my explanation make sense? I know what I mean, but I'm having trouble describing what I mean. I'll try to expound if I've been unclear) Thanks for all your work and all your input. Best Regards, |
Good to hear from you, no problem on the delay.
I kind of figured as much but just wanted to be sure. The only problem I see with this (aside from the account issue with posting) is that Reddit has a nasty tendency to reject multiple requests if they are sent too quickly back-to-back. It's probably (in part) a security feature to limit DDoS's and bot spam. As far as I can see, the solution would require a sleep call between requests. Not a big deal, but it would make the tests take longer at runtime.
I already changed it to not require a username and password to run in my fork. I didn't push the commits because I wanted to get your opinion first. It's worked fine for me. The only downside is it requires the user to know that they need to provide a login prior to submitting posts or comments ( voting ect.) - that shouldn't be a huge issue so long as it's clearly documented. Even so, we could create a check_login subroutine that verifies that username and password aren't null before running those methods - otherwise throwing an error.
Pretty much any search feature. Querying posts on the front page or any subreddit. Viewing post comments (a method I added in my last commit) or post or user details. Of course it depends on the program, but I think it's safe to say that these methods are typically used a lot more than ones that require verification.
Definitely. I've written some programs which utilize my current fork in the past few weeks. Having to supply a login just to view the front page or a particular subreddit seems very unnecessary in retrospect. I much prefer only requiring it when necessary. I imagine it also reduces overhead and response time (I don't have any data to support that though).
Perhaps a little because we'd likely implement a check_login at some point. Pretty minuscule and, in my opinion, well worth the trade-off.
I don't have much experience with writing test scripts so I'm not sure how to implement it that way. I'll have to research that. If so, we wouldn't have to worry about Reddit rejecting back-to-back requests or worrying about how to test comment or post submitting without spamming Reddit. On the other hand, it would probably require a lot more time to code, debug, and maintain. I'm really not sure either way. : /
My pleasure. :) I'm glad that there's a way I can contribute to the perl and Reddit communities. On that note, I'm off work for the next week. I'll see what else I can add in the meantime. |
Need to write tests for this module
The text was updated successfully, but these errors were encountered: