forked from pool/python-pamela
osc copypac from project:home:jayvdb:jupyter package:python-pamela revision:9
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pamela?expand=0&rev=1
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
3
pamela-1.0.0.tar.gz
Normal file
3
pamela-1.0.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:65c9389bef7d1bb0b168813b6be21964df32016923aac7515bdf05366acbab6c
|
||||
size 6658
|
||||
4
python-pamela.changes
Normal file
4
python-pamela.changes
Normal file
@@ -0,0 +1,4 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 8 10:56:58 AM UTC 2019 - John Vandenberg <jayvdb@gmail.com>
|
||||
|
||||
- Initial spec for v1.0.0
|
||||
60
python-pamela.spec
Normal file
60
python-pamela.spec
Normal file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# spec file for package python-pamela
|
||||
#
|
||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-pamela
|
||||
Version: 1.0.0
|
||||
Release: 0
|
||||
License: MIT
|
||||
Summary: PAM interface using ctypes
|
||||
Url: https://github.com/minrk/pamela
|
||||
Group: Development/Languages/Python
|
||||
Source: https://files.pythonhosted.org/packages/source/p/pamela/pamela-%{version}.tar.gz
|
||||
Source1: https://raw.githubusercontent.com/minrk/pamela/master/test_pamela.py
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildArch: noarch
|
||||
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
PAM interface using ctypes.
|
||||
|
||||
%prep
|
||||
%setup -q -n pamela-%{version}
|
||||
cp %SOURCE1 .
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%pytest || true
|
||||
#-k 'not test_session'
|
||||
ls -al /var/log/
|
||||
|
||||
%files %{python_files}
|
||||
%doc README.md
|
||||
%license COPYING
|
||||
%{python_sitelib}/*
|
||||
|
||||
%changelog
|
||||
77
test_pamela.py
Normal file
77
test_pamela.py
Normal file
@@ -0,0 +1,77 @@
|
||||
import getpass
|
||||
|
||||
import pytest
|
||||
|
||||
import pamela
|
||||
|
||||
|
||||
def test_pam_error_noargs():
|
||||
e = pamela.PAMError()
|
||||
s = str(e)
|
||||
r = repr(e)
|
||||
assert 'Unknown' in s
|
||||
assert 'Unknown' in r
|
||||
|
||||
|
||||
def test_pam_error_errno():
|
||||
en = 2
|
||||
e = pamela.PAMError(errno=en)
|
||||
assert str(en) in str(e)
|
||||
assert 'Unknown' not in str(e)
|
||||
|
||||
|
||||
def test_auth_nouser():
|
||||
with pytest.raises(pamela.PAMError) as exc_info:
|
||||
pamela.authenticate('userdoesntexist', 'wrongpassword')
|
||||
|
||||
e = exc_info.value
|
||||
assert 'Unknown' not in str(e)
|
||||
|
||||
|
||||
def test_auth_badpassword():
|
||||
with pytest.raises(pamela.PAMError) as exc_info:
|
||||
pamela.authenticate(getpass.getuser(), 'wrongpassword')
|
||||
|
||||
e = exc_info.value
|
||||
assert 'Unknown' not in str(e)
|
||||
|
||||
|
||||
def test_all():
|
||||
for name in pamela.__all__:
|
||||
getattr(pamela, name)
|
||||
|
||||
|
||||
def test_environment():
|
||||
handle = pamela.pam_start(getpass.getuser(), 'login')
|
||||
|
||||
k1, v1 = 'A', 'hat'
|
||||
handle.put_env(k1, v1)
|
||||
assert v1 == handle.get_env(k1)
|
||||
|
||||
k2, v2 = 'B', 'dog'
|
||||
handle.put_env(k2, v2)
|
||||
assert v2 == handle.get_env(k2)
|
||||
|
||||
assert handle.get_envlist() == {k1: v1, k2: v2}
|
||||
|
||||
with pytest.raises(pamela.PAMError):
|
||||
handle.get_env("doesn't exist")
|
||||
|
||||
handle.del_env(k2)
|
||||
|
||||
with pytest.raises(pamela.PAMError):
|
||||
handle.get_env(k2)
|
||||
|
||||
assert handle.get_envlist() == {k1: v1}
|
||||
|
||||
# test set_item / get_item
|
||||
handle.set_item(pamela.PAM_RHOST, '127.0.0.1')
|
||||
|
||||
assert handle.get_item(pamela.PAM_RHOST) == '127.0.0.1'
|
||||
assert handle.get_item(pamela.PAM_RUSER) == None
|
||||
|
||||
|
||||
def test_session():
|
||||
handle = pamela.pam_start(getpass.getuser(), 'login')
|
||||
handle.open_session()
|
||||
handle.close_session()
|
||||
Reference in New Issue
Block a user