-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
... to be actual unit tests (as opposed to being integration tests that tests the actual setup in which it's being run)
- Loading branch information
Showing
1 changed file
with
9 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
import os | ||
import unittest | ||
|
||
from pathlib import Path | ||
from juju.utils import juju_config_dir, juju_ssh_key_paths | ||
|
||
|
||
def test_config_dir(): | ||
config_dir = juju_config_dir() | ||
assert os.path.exists(config_dir) | ||
assert os.path.isdir(config_dir) | ||
class TestDirResolve(unittest.TestCase): | ||
def test_config_dir(self): | ||
config_dir = juju_config_dir() | ||
assert 'local/share/juju' in config_dir | ||
|
||
assert os.path.exists(os.path.join(config_dir, 'controllers.yaml')) | ||
|
||
|
||
def test_juju_ssh_key_paths(): | ||
public, private = juju_ssh_key_paths() | ||
assert os.path.exists(public) | ||
assert os.path.isfile(public) | ||
|
||
assert os.path.exists(private) | ||
assert os.path.isfile(private) | ||
|
||
with Path(public).open('r') as f: | ||
assert "ssh-rsa" in f.read() | ||
|
||
with Path(private).open('r') as g: | ||
assert "PRIVATE KEY" in g.read() | ||
def test_juju_ssh_key_paths(self): | ||
public, private = juju_ssh_key_paths() | ||
assert public.endswith('ssh/juju_id_rsa.pub') | ||
assert private.endswith('ssh/juju_id_rsa') |