def test_resources(self): """Resources from the charm are copied to the service tree.""" install_resources(root_dir=Path(self.root_dir.path)) self.assertThat( self.root_dir.join('srv/archive-auth-mirror/bin/mirror-archive'), FileContains(matcher=Contains("import mirror_archive"))) self.assertThat( self.root_dir.join('srv/archive-auth-mirror/bin/manage-user'), FileContains(matcher=Contains("import manage_user"))) sign_script_path = 'srv/archive-auth-mirror/bin/reprepro-sign-helper' self.assertThat( self.root_dir.join(sign_script_path), FileContains(matcher=Contains("import reprepro_sign_helper"))) auth_file = self.root_dir.join('srv/archive-auth-mirror/basic-auth') self.assertEqual(0o100640, os.stat(auth_file).st_mode)
def test_tree(self): """The install_resources function creates the filesystem structure.""" install_resources(root_dir=Path(self.root_dir.path)) paths = ['basic-auth', 'bin', 'static', 'reprepro', 'sign-passphrase'] self.assertThat( self.root_dir.join('srv/archive-auth-mirror'), DirContains(paths))
def install(): setup.install_resources() set_state(charm_state('installed'))
def test_basic_auth_file_owner(self): """The basic-auth file is group-owned by www-data.""" install_resources(root_dir=Path(self.root_dir.path)) # the file ownership is changed to the gid for www-data self.mock_fchown.assert_any_call(mock.ANY, 0, 123)
def install(): setup.install_resources() set_flag(charm_flag('installed'))