Skip to content

Commit

Permalink
Updates sd-app gpg config tests
Browse files Browse the repository at this point in the history
Follow-up to [0]. Post-consolidation, we can expect the /etc/profile.d/
path to be present on all systems, but only on sd-app should it return
"sd-gpg" rather than an empty string.

[0] #623
  • Loading branch information
Conor Schaefer committed Oct 19, 2020
1 parent a366613 commit 17cc36f
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,12 @@ def qubes_gpg_domain_configured(self, vmname=False):
sd-app should have it set to sd-gpg.
All other AppVMs should not have this configured.
"""
expected_profile_app = 'if [ "$(qubesdb-read /name)" = "sd-app" ]; then export QUBES_GPG_DOMAIN="sd-gpg"; fi\n' # noqa: E501
expected_env_app = "sd-gpg"
expected_env_all = ""
profile_path = "/etc/profile.d/sd-app-qubes-gpg-domain.sh"

env_cmd = 'echo "$QUBES_GPG_DOMAIN"'
env_contents = self._run(env_cmd)

if vmname == "sd-app":
self.assertTrue(self._fileExists(profile_path))
profile_contents = self._get_file_contents(profile_path)
self.assertEqual(profile_contents, expected_profile_app)
self.assertEqual(env_contents, expected_env_app)
expected_env = "sd-gpg"
else:
self.assertFalse(self._fileExists(profile_path))
self.assertEqual(env_contents, expected_env_all)
expected_env = ""

self.assertEqual(env_contents, expected_env)

0 comments on commit 17cc36f

Please sign in to comment.