Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upUnit and functional tests #999
Comments
Safihre
added
Help Wanted
New feature
labels
Aug 10, 2017
Safihre
added this to the Backlog milestone
Aug 10, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sanderjo
Aug 11, 2017
Contributor
Can it be an(other) existing NNTP-server?
Must the NNTP-server be in python code, or can it be in C or Go?
|
Can it be an(other) existing NNTP-server? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Aug 11, 2017
Member
It can be another yes, and the language also doesn't really matter I think. We can use TravisCI and Appveyor to compile it before running the tests.
|
It can be another yes, and the language also doesn't really matter I think. We can use TravisCI and Appveyor to compile it before running the tests. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Hellowlol
Aug 11, 2017
Contributor
What wrong with using nzbgets nserv? It even states that it can be used with other clients.
|
What wrong with using nzbgets nserv? It even states that it can be used with other clients. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
It's like using Android to test iOS |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@Safihre Are you gonna use pytest? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
No clue, is that the easiest? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Yep. Its a lot less boilerplate. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Aug 24, 2017
Member
@sanderjo @Hellowlol (and anybody else wanting to help): I created a tasks list of things that should be included, maybe this helps to get things going
|
@sanderjo @Hellowlol (and anybody else wanting to help): I created a tasks list of things that should be included, maybe this helps to get things going |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Maybe we can use twisted AS nntp server. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Aug 25, 2017
Member
Sure, you have experience with it? I don't but it seems interesting.
It doesn't have to by high performance at all, just has to work
|
Sure, you have experience with it? I don't but it seems interesting. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Sep 6, 2017
Member
I have added super basic tests, it will start SABnzbd and then test for basic API and page-serving functionality.
At least that would prevent what happened with 2.3.0Alpha1 where the Config > Switches page didn't work.
Much more work to do!
|
I have added super basic tests, it will start SABnzbd and then test for basic API and page-serving functionality. Much more work to do! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
any doc on how to add tests / run it / etc.. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Sep 6, 2017
Member
Will add docs when there's actually functional tests, the tests are embarrassingly simple right now.
But in case (shutdown SABnzbd first!):
pip install pytest pytest-xprocess
pytest
|
Will add docs when there's actually functional tests, the tests are embarrassingly simple right now.
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Sep 7, 2017
Member
Working in this branch: https://github.com/sabnzbd/sabnzbd/tree/feature/pytest
If anyone wants to contribute, just PR against that
Just added basic testing of adding and removing NZB's.
Thinking of just using the SABnzbd Giganews account for now to test downloading (with the username/password encoded of course) of some of @sanderjo's test NZB's.
|
Working in this branch: https://github.com/sabnzbd/sabnzbd/tree/feature/pytest Thinking of just using the SABnzbd Giganews account for now to test downloading (with the username/password encoded of course) of some of @sanderjo's test NZB's. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Hellowlol
Sep 7, 2017
Contributor
Good stuff, i got some stuff i need to finish (sabapi for one) but ill see if i cant get started this week.
|
Good stuff, i got some stuff i need to finish (sabapi for one) but ill see if i cant get started this week. |
added a commit
that referenced
this issue
Sep 8, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
AppVeyor was added to also enable automatic Windows platform testing. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Hellowlol
Sep 25, 2017
Contributor
http://flylib.com/books/en/2.407.1.69/1/ describe how to setup a minimal nntp server using twisted. Ill try to play with it and see how it goes.
|
http://flylib.com/books/en/2.407.1.69/1/ describe how to setup a minimal nntp server using twisted. Ill try to play with it and see how it goes. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Sep 26, 2017
Member
@Hellowlol interesting, very extensive. Doesn't include the yEnc encoding as far as I can see, but good basis!
|
@Hellowlol interesting, very extensive. Doesn't include the yEnc encoding as far as I can see, but good basis! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
OldskoolOrion
Oct 8, 2017
I will start looking into this as well as first task.. I used Mozilla's MailMan FakeServer back in the day which was really nice for functional testing of imap-, smtp-, nntp-protocol stuff etc (conforming to rfc) - lot of examples there to start with and easy integratable in automatic workflow by the looks of it. Need to dive in and get my hands dirty to be 100% sure its a good choice of course, since I'm not yet knee-deep in sab's codebase either, and have no helicopter view yet of all the needed reqs.
Yes it's old and yes it's in that horrible javashit non-language, but if it do exactly what we want and is extremely easy to extend and adept, it's a valid option I think.
Besides that I already checked out some nice Golang based nntp-server & client stuff, which is OS, well supported and even in use live, let alone just as local server for functional testing.. I'm definitely going to dive deeper into that as well, since I still have to start teaching myself Go on a more than basic-level. Very platform-independent, quite fast, good libs and friendly community with quality server-client related packages out there.
And if all this plus stuff that's under investigation fails for us.. then there's always nserv.. but I agree.. out of respect to sab itself and nzbget as well.. it would be more elegant if sab wouldn't have to rely on nserv :-)
Lotsa spare time tomorrow to start rocking.. documentation has been collected.. a lot of source code has been git'd.
Good start to getting to know the codebase while actually doing something useful :-)
OldskoolOrion
commented
Oct 8, 2017
|
I will start looking into this as well as first task.. I used Mozilla's MailMan FakeServer back in the day which was really nice for functional testing of imap-, smtp-, nntp-protocol stuff etc (conforming to rfc) - lot of examples there to start with and easy integratable in automatic workflow by the looks of it. Need to dive in and get my hands dirty to be 100% sure its a good choice of course, since I'm not yet knee-deep in sab's codebase either, and have no helicopter view yet of all the needed reqs. Yes it's old and yes it's in that horrible javashit non-language, but if it do exactly what we want and is extremely easy to extend and adept, it's a valid option I think. Besides that I already checked out some nice Golang based nntp-server & client stuff, which is OS, well supported and even in use live, let alone just as local server for functional testing.. I'm definitely going to dive deeper into that as well, since I still have to start teaching myself Go on a more than basic-level. Very platform-independent, quite fast, good libs and friendly community with quality server-client related packages out there. And if all this plus stuff that's under investigation fails for us.. then there's always nserv.. but I agree.. out of respect to sab itself and nzbget as well.. it would be more elegant if sab wouldn't have to rely on nserv :-) Lotsa spare time tomorrow to start rocking.. documentation has been collected.. a lot of source code has been git'd. |
referenced
this issue
Dec 6, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Apr 1, 2018
Member
I am trying to add a simple unit-test, but I am failing.
How would I test for example sabnzbd.misc.calc_age from a test .py file in the tests directory executed by pytest?
Anyone that can help me out? :)
|
I am trying to add a simple unit-test, but I am failing. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Hellowlol
Apr 1, 2018
Contributor
I normally import the stuff I need in conftest.py then in test_misc.py
from conftest import misc
def test_calc_age():
pass
|
I normally import the stuff I need in conftest.py then in test_misc.py
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Safihre
Aug 14, 2018
Member
I am considering (due to a project at work) moving the functional tests to an actual functional-testing tool like Selenium. This way we can test actual user flow instead of just API calls.
|
I am considering (due to a project at work) moving the functional tests to an actual functional-testing tool like Selenium. This way we can test actual user flow instead of just API calls. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wwwehr
commented
Aug 19, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
james-d-elliott
Sep 14, 2018
I can probably setup a server for this if we are still looking for something, and I might work out how to build a docker image for it.
james-d-elliott
commented
Sep 14, 2018
|
I can probably setup a server for this if we are still looking for something, and I might work out how to build a docker image for it. |
Safihre commentedAug 10, 2017
•
edited
We really need unit and functional tests.
Biggest hurdle, especially for functional tests: we need a mock-NNTP server.
We could use NZBGet's NServ, but that kind of feels wrong...
Anyone that wants to help me with this?
Especially with the creation of this mock NNTP server.
Tasks and tests:
.nzb.tar.gz, or.zipor.rar{{}}file.nzbor from tag inside NZB)file{{}}.nzbor from tag inside NZB)