Commit a4f0e1c0 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][core] Create base class with common remote tests

parent 779281c3
......@@ -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, AssetBaseTest):
class OnlineAssetTestCase(LiveServerTestCase, OnlineTestMixin, AssetRemoteTest):
"""Test case using django live server for asset related remote tests"""
def setUp(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment