mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
if sync server offline, abort sync tests
This commit is contained in:
parent
f131021c7e
commit
bf3bb9dd32
3 changed files with 18 additions and 1 deletions
|
@ -8,6 +8,7 @@ from anki.consts import *
|
||||||
from anki.lang import _
|
from anki.lang import _
|
||||||
|
|
||||||
# fixmes:
|
# fixmes:
|
||||||
|
# - make sure users can't set grad interval < 1
|
||||||
# - make sure lists like new[delays] are not being shared by multiple groups
|
# - make sure lists like new[delays] are not being shared by multiple groups
|
||||||
# - make sure all children have parents (create as necessary)
|
# - make sure all children have parents (create as necessary)
|
||||||
# - when renaming a group, top level properties should be added or removed as
|
# - when renaming a group, top level properties should be added or removed as
|
||||||
|
|
|
@ -22,6 +22,8 @@ SYNC_PORT = int(os.environ.get("SYNC_PORT") or 80)
|
||||||
SYNC_URL = "http://%s:%d/sync/" % (SYNC_HOST, SYNC_PORT)
|
SYNC_URL = "http://%s:%d/sync/" % (SYNC_HOST, SYNC_PORT)
|
||||||
SYNC_VER = 0
|
SYNC_VER = 0
|
||||||
|
|
||||||
|
# - 64 bit guid will be munged in js; need to escape or rethink
|
||||||
|
|
||||||
# - make sure /sync/download is compressed
|
# - make sure /sync/download is compressed
|
||||||
# - status() should be using the hooks instead
|
# - status() should be using the hooks instead
|
||||||
|
|
||||||
|
|
|
@ -256,6 +256,7 @@ anki.sync.SYNC_URL = "http://localhost:8001/sync/"
|
||||||
TEST_USER = "synctest@ichi2.net"
|
TEST_USER = "synctest@ichi2.net"
|
||||||
TEST_PASS = "synctest"
|
TEST_PASS = "synctest"
|
||||||
TEST_HKEY = "k14LvSaEtXFITCJz"
|
TEST_HKEY = "k14LvSaEtXFITCJz"
|
||||||
|
TEST_REMOTE = True
|
||||||
|
|
||||||
def setup_remote():
|
def setup_remote():
|
||||||
global server
|
global server
|
||||||
|
@ -267,7 +268,14 @@ def setup_remote():
|
||||||
|
|
||||||
@nose.with_setup(setup_remote)
|
@nose.with_setup(setup_remote)
|
||||||
def test_meta():
|
def test_meta():
|
||||||
|
global TEST_REMOTE
|
||||||
|
try:
|
||||||
(mod, scm, usn, ts) = server.meta()
|
(mod, scm, usn, ts) = server.meta()
|
||||||
|
except Exception, e:
|
||||||
|
if e.errno == 61:
|
||||||
|
TEST_REMOTE = False
|
||||||
|
print "aborting; server offline"
|
||||||
|
return
|
||||||
assert mod
|
assert mod
|
||||||
assert scm
|
assert scm
|
||||||
assert mod != client.deck.mod
|
assert mod != client.deck.mod
|
||||||
|
@ -275,6 +283,8 @@ def test_meta():
|
||||||
|
|
||||||
@nose.with_setup(setup_remote)
|
@nose.with_setup(setup_remote)
|
||||||
def test_hkey():
|
def test_hkey():
|
||||||
|
if not TEST_REMOTE:
|
||||||
|
return
|
||||||
assertException(Exception, lambda: server.hostKey("wrongpass"))
|
assertException(Exception, lambda: server.hostKey("wrongpass"))
|
||||||
server.hkey = "abc"
|
server.hkey = "abc"
|
||||||
k = server.hostKey(TEST_PASS)
|
k = server.hostKey(TEST_PASS)
|
||||||
|
@ -282,6 +292,8 @@ def test_hkey():
|
||||||
|
|
||||||
@nose.with_setup(setup_remote)
|
@nose.with_setup(setup_remote)
|
||||||
def test_download():
|
def test_download():
|
||||||
|
if not TEST_REMOTE:
|
||||||
|
return
|
||||||
f = FullSyncer(client.deck, "abc")
|
f = FullSyncer(client.deck, "abc")
|
||||||
assertException(Exception, f.download)
|
assertException(Exception, f.download)
|
||||||
f.hkey = TEST_HKEY
|
f.hkey = TEST_HKEY
|
||||||
|
@ -289,6 +301,8 @@ def test_download():
|
||||||
|
|
||||||
@nose.with_setup(setup_remote)
|
@nose.with_setup(setup_remote)
|
||||||
def test_remoteSync():
|
def test_remoteSync():
|
||||||
|
if not TEST_REMOTE:
|
||||||
|
return
|
||||||
# not yet associated, so will require a full sync
|
# not yet associated, so will require a full sync
|
||||||
assert client.sync() == "fullSync"
|
assert client.sync() == "fullSync"
|
||||||
# upload
|
# upload
|
||||||
|
|
Loading…
Reference in a new issue