Ejemplo n.º 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
Ejemplo n.º 2
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
Ejemplo n.º 3
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
Ejemplo n.º 4
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
Ejemplo n.º 5
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
Ejemplo n.º 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
Ejemplo n.º 7
0
def test_get_token_from_file(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    f = open(k.tokenfile, 'w')
    f.write("{'auths': {'a': 'titib'}}")
    f.close()
    assert k.token('a') == "titib"
Ejemplo n.º 8
0
def test_get_token_from_file(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    f = open(k.tokenfile, 'w')
    f.write("{'auths': {'a': 'titib'}}")
    f.close()
    assert k.token('a') == "titib"
Ejemplo n.º 9
0
def test_create_delete_get_token(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.token = "titia"
    assert k.token == "titia"
    k.delete_token()
    assert k.token is None
Ejemplo n.º 10
0
def test_create_token_file(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.token = "titib"
    assert os.path.exists(k.tokenfile) is True
    f = open(k.tokenfile, 'r')
    r = f.read()
    f.close()
    assert r == "titib"
Ejemplo n.º 11
0
def test_get_empty_token(fake_home):
    k = KpmAuth()
    assert k.token('*') is None
    assert k.tokens is None
Ejemplo n.º 12
0
def test_get_empty_token(fake_home):
    k = KpmAuth()
    assert k.token('*') is None
    assert k.tokens is None
Ejemplo n.º 13
0
def test_create_token_value(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.token = "titic"
    assert k.token == "titic"
Ejemplo n.º 14
0
def test_delete_token(fake_home):
    """ Should not fail if there is no token """
    k = KpmAuth()
    k.token = "titid"
    assert k.delete_token() == "titid"
    assert os.path.exists(k.tokenfile) is False