Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sick-Beard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
Sick-Beard
Commits
2aff89ec
Commit
2aff89ec
authored
13 years ago
by
Dennis Lutter
Browse files
Options
Downloads
Patches
Plain Diff
support test on multiple episodes and you can disable singe test cases
parent
aa406617
No related branches found
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/snatch_tests.py
+16
-9
16 additions, 9 deletions
tests/snatch_tests.py
with
16 additions
and
9 deletions
tests/snatch_tests.py
+
16
−
9
View file @
2aff89ec
...
@@ -29,12 +29,12 @@ import sickbeard
...
@@ -29,12 +29,12 @@ import sickbeard
from
sickbeard.tv
import
TVEpisode
,
TVShow
from
sickbeard.tv
import
TVEpisode
,
TVShow
import
sickbeard.common
as
c
import
sickbeard.common
as
c
tests
=
{
"
Dexter
"
:
{
"
q
"
:
c
.
HD
,
"
s
"
:
5
,
"
e
"
:
7
,
"
b
"
:
'
Dexter.S05E07.720p.BluRay.X264-REWARD
'
,
"
i
"
:
[
'
Dexter.S05E07.720p.BluRay.X264-REWARD
'
,
'
Dexter.S05E07.720p.X264-REWARD
'
]},
tests
=
{
"
Dexter
"
:
{
"
a
"
:
1
,
"
q
"
:
c
.
HD
,
"
s
"
:
5
,
"
e
"
:
[
7
],
"
b
"
:
'
Dexter.S05E07.720p.BluRay.X264-REWARD
'
,
"
i
"
:
[
'
Dexter.S05E07.720p.BluRay.X264-REWARD
'
,
'
Dexter.S05E07.720p.X264-REWARD
'
]},
"
House
"
:
{
"
q
"
:
c
.
HD
,
"
s
"
:
4
,
"
e
"
:
5
,
"
b
"
:
'
House.4x5.720p.BluRay.X264-REWARD
'
,
"
i
"
:
[
'
Dexter.S05E04.720p.X264-REWARD
'
,
'
House.4x5.720p.BluRay.X264-REWARD
'
]}
"
House
"
:
{
"
a
"
:
1
,
"
q
"
:
c
.
HD
,
"
s
"
:
4
,
"
e
"
:
[
5
],
"
b
"
:
'
House.4x5.720p.BluRay.X264-REWARD
'
,
"
i
"
:
[
'
Dexter.S05E04.720p.X264-REWARD
'
,
'
House.4x5.720p.BluRay.X264-REWARD
'
]},
"
Hells Kitchen
"
:
{
"
a
"
:
1
,
"
q
"
:
c
.
SD
,
"
s
"
:
6
,
"
e
"
:
[
14
,
15
],
"
b
"
:
'
Hells.Kitchen.s6e14e15.HDTV.XviD-ASAP
'
,
"
i
"
:
[
'
Hells.Kitchen.S06E14.HDTV.XviD-ASAP
'
,
'
Hells.Kitchen.6x14.HDTV.XviD-ASAP
'
,
'
Hells.Kitchen.s6e14e15.HDTV.XviD-ASAP
'
]}
}
}
def
_create_fake_xml
(
items
):
def
_create_fake_xml
(
items
):
xml
=
'
<?xml version=
"
1.0
"
encoding=
"
UTF-8
"
?><rss version=
"
2.0
"
xmlns:atom=
"
http://www.w3.org/2005/Atom
"
xmlns:newznab=
"
http://www.newznab.com/DTD/2010/feeds/attributes/
"
encoding=
"
utf-8
"
><channel>
'
xml
=
'
<?xml version=
"
1.0
"
encoding=
"
UTF-8
"
?><rss version=
"
2.0
"
xmlns:atom=
"
http://www.w3.org/2005/Atom
"
xmlns:newznab=
"
http://www.newznab.com/DTD/2010/feeds/attributes/
"
encoding=
"
utf-8
"
><channel>
'
for
item
in
items
:
for
item
in
items
:
...
@@ -43,6 +43,7 @@ def _create_fake_xml(items):
...
@@ -43,6 +43,7 @@ def _create_fake_xml(items):
xml
+=
'
</channel></rss>
'
xml
+=
'
</channel></rss>
'
return
xml
return
xml
# the real one tries to contact tvdb just stop it from getting more info on the ep
# the real one tries to contact tvdb just stop it from getting more info on the ep
def
_fake_specifyEP
(
self
,
season
,
episode
):
def
_fake_specifyEP
(
self
,
season
,
episode
):
pass
pass
...
@@ -51,6 +52,7 @@ TVEpisode.specifyEpisode = _fake_specifyEP
...
@@ -51,6 +52,7 @@ TVEpisode.specifyEpisode = _fake_specifyEP
searchItems
=
[]
searchItems
=
[]
class
SearchTest
(
test
.
SickbeardTestDBCase
):
class
SearchTest
(
test
.
SickbeardTestDBCase
):
def
_fake_getURL
(
self
,
url
,
headers
=
None
):
def
_fake_getURL
(
self
,
url
,
headers
=
None
):
...
@@ -67,6 +69,7 @@ class SearchTest(test.SickbeardTestDBCase):
...
@@ -67,6 +69,7 @@ class SearchTest(test.SickbeardTestDBCase):
super
(
SearchTest
,
self
).
__init__
(
something
)
super
(
SearchTest
,
self
).
__init__
(
something
)
def
test_generator
(
tvdbdid
,
show_name
,
curData
,
forceSearch
):
def
test_generator
(
tvdbdid
,
show_name
,
curData
,
forceSearch
):
def
test
(
self
):
def
test
(
self
):
...
@@ -78,14 +81,15 @@ def test_generator(tvdbdid, show_name, curData, forceSearch):
...
@@ -78,14 +81,15 @@ def test_generator(tvdbdid, show_name, curData, forceSearch):
show
.
saveToDB
()
show
.
saveToDB
()
sickbeard
.
showList
.
append
(
show
)
sickbeard
.
showList
.
append
(
show
)
episode
=
TVEpisode
(
show
,
curData
[
"
s
"
],
curData
[
"
e
"
])
for
epNumber
in
curData
[
"
e
"
]:
episode
=
TVEpisode
(
show
,
curData
[
"
s
"
],
epNumber
)
episode
.
status
=
c
.
WANTED
episode
.
status
=
c
.
WANTED
episode
.
saveToDB
()
episode
.
saveToDB
()
bestResult
=
search
.
findEpisode
(
episode
,
forceSearch
)
bestResult
=
search
.
findEpisode
(
episode
,
forceSearch
)
if
not
bestResult
:
if
not
bestResult
:
self
.
assertEqual
(
curData
[
"
b
"
],
bestResult
)
self
.
assertEqual
(
curData
[
"
b
"
],
bestResult
)
self
.
assertEqual
(
curData
[
"
b
"
],
bestResult
.
name
)
self
.
assertEqual
(
curData
[
"
b
"
],
bestResult
.
name
)
#first is expected, second is choosen one
return
test
return
test
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
@@ -97,10 +101,13 @@ if __name__ == '__main__':
...
@@ -97,10 +101,13 @@ if __name__ == '__main__':
tvdbdid
=
1
tvdbdid
=
1
for
forceSearch
in
(
True
,
False
):
for
forceSearch
in
(
True
,
False
):
for
name
,
curData
in
tests
.
items
():
for
name
,
curData
in
tests
.
items
():
if
not
curData
[
"
a
"
]:
continue
fname
=
name
.
replace
(
'
'
,
'
_
'
)
if
forceSearch
:
if
forceSearch
:
test_name
=
'
test_manual_%s_%s
'
%
(
name
,
tvdbdid
)
test_name
=
'
test_manual_%s_%s
'
%
(
f
name
,
tvdbdid
)
else
:
else
:
test_name
=
'
test_%s_%s
'
%
(
name
,
tvdbdid
)
test_name
=
'
test_%s_%s
'
%
(
f
name
,
tvdbdid
)
test
=
test_generator
(
tvdbdid
,
name
,
curData
,
forceSearch
)
test
=
test_generator
(
tvdbdid
,
name
,
curData
,
forceSearch
)
setattr
(
SearchTest
,
test_name
,
test
)
setattr
(
SearchTest
,
test_name
,
test
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment