Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
a4f0e1c0
Commit
a4f0e1c0
authored
Oct 15, 2019
by
Samuel GAIST
Browse files
[test][core] Create base class with common remote tests
parent
779281c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/test/core.py
View file @
a4f0e1c0
...
...
@@ -47,6 +47,7 @@ from click.testing import CliRunner
from
beat.core.test.utils
import
cleanup
from
beat.core.test.utils
import
skipif
from
beat.core.test.utils
import
slow
from
beat.cmdline.scripts
import
main_cli
from
..
import
common
...
...
@@ -146,6 +147,7 @@ class AssetLocalTest(AssetBaseTest):
def
__init__
(
self
):
super
().
__init__
()
nose
.
tools
.
assert_true
(
self
.
object_map
)
nose
.
tools
.
assert_is_not_none
(
self
.
storage_cls
)
def
test_local_list
(
self
):
exit_code
,
outputs
=
self
.
call
(
"list"
)
...
...
@@ -217,6 +219,38 @@ class AssetLocalTest(AssetBaseTest):
nose
.
tools
.
assert_false
(
storage
.
exists
())
class
AssetRemoteTest
(
AssetBaseTest
):
object_map
=
{}
storage_cls
=
None
asset_cls
=
None
def
__init__
(
self
):
super
().
__init__
()
nose
.
tools
.
assert_true
(
self
.
object_map
)
@
slow
@
skip_disconnected
def
test_remote_list
(
self
):
exit_code
,
output
=
self
.
call
(
"list"
,
"--remote"
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
@
slow
@
skip_disconnected
def
test_pull_one
(
self
,
obj
=
None
):
obj
=
obj
or
self
.
object_map
[
"pull"
]
exit_code
,
output
=
self
.
call
(
"pull"
,
obj
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
storage
=
self
.
storage_cls
(
tmp_prefix
,
obj
)
nose
.
tools
.
assert_true
(
storage
.
exists
())
return
storage
@
slow
@
skip_disconnected
def
test_pull_all
(
self
):
exit_code
,
output
=
self
.
call
(
"pull"
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
class
OnlineTestMixin
:
"""Mixin for using Django's live server"""
...
...
@@ -253,7 +287,7 @@ class OnlineTestCase(LiveServerTestCase, OnlineTestMixin, BaseTest):
base
.
setUp
(
self
)
class
OnlineAssetTestCase
(
LiveServerTestCase
,
OnlineTestMixin
,
Asset
Bas
eTest
):
class
OnlineAssetTestCase
(
LiveServerTestCase
,
OnlineTestMixin
,
Asset
Remot
eTest
):
"""Test case using django live server for asset related remote tests"""
def
setUp
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment