示例#1
0
def test_create_delete_get_token(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.add_token('a', "titia")
    assert k.token('a') == "titia"
    k.delete_token('a')
    assert k.token('a') is None
示例#2
0
def test_delete_token(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.add_token('*', "titid")
    assert k.token('*') == "titid"
    assert k.delete_token('*') == "titid"
    assert k.token('*') is None
示例#3
0
文件: test_auth.py 项目: coreos/kpm
def test_create_delete_get_token(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.add_token('a', "titia")
    assert k.token('a') == "titia"
    k.delete_token('a')
    assert k.token('a') is None
示例#4
0
文件: test_auth.py 项目: coreos/kpm
def test_delete_token(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.add_token('*', "titid")
    assert k.token('*') == "titid"
    assert k.delete_token('*') == "titid"
    assert k.token('*') is None
示例#5
0
def test_create_token_file(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.add_token('a', "titib")
    assert os.path.exists(k.tokenfile) is True
    f = open(k.tokenfile, 'r')
    r = f.read()
    assert {'auths': {'a': 'titib'}} == yaml.load(r)
示例#6
0
def test_create_token_value(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.add_token('a', "titic")
    k.add_token('b', "titib")
    assert k.token('a') == "titic"
    assert k.token('a') == "titic"
    assert k.token('c') is None
示例#7
0
文件: test_auth.py 项目: coreos/kpm
def test_create_token_file(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.add_token('a', "titib")
    assert os.path.exists(k.tokenfile) is True
    f = open(k.tokenfile, 'r')
    r = f.read()
    assert  {'auths': {'a': 'titib'}} == yaml.load(r)
示例#8
0
文件: test_auth.py 项目: coreos/kpm
def test_create_token_value(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.add_token('a', "titic")
    k.add_token('b', "titib")
    assert k.token('a') == "titic"
    assert k.token('a') == "titic"
    assert k.token('c') is None