summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-03-09 17:27:19 +0000
committerCoprDistGit <infra@openeuler.org>2023-03-09 17:27:19 +0000
commit8109b7204e0369c390958fb046783e81b0677702 (patch)
tree56b0f1a0f373a8edf7fe38cd0e1b5d7f32aebc97
parent47d8ef363cc9bfde95322e982f1b35f489fd5778 (diff)
automatic import of python-test_server
-rw-r--r--.gitignore1
-rw-r--r--python-test_server.spec246
-rw-r--r--sources1
3 files changed, 248 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..3d5c054 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/test_server-0.0.42.tar.gz
diff --git a/python-test_server.spec b/python-test_server.spec
new file mode 100644
index 0000000..f30b9d5
--- /dev/null
+++ b/python-test_server.spec
@@ -0,0 +1,246 @@
+%global _empty_manifest_terminate_build 0
+Name: python-test-server
+Version: 0.0.42
+Release: 1
+Summary: Server for testing HTTP clients
+License: The MIT License (MIT) Copyright (c) 2015-2023, Gregory Petukhov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+URL: https://pypi.org/project/test-server/
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/23/dd/d8e2f93c19d18351235f9540ec7d8eec7559c0160db8c8007c01595dc90e/test_server-0.0.42.tar.gz
+BuildArch: noarch
+
+
+%description
+# Documentation for test_server package
+
+[![Test Status](https://github.com/lorien/test_server/actions/workflows/test.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/test.yml)
+[![Code Quality](https://github.com/lorien/test_server/actions/workflows/check.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/test.yml)
+[![Type Check](https://github.com/lorien/test_server/actions/workflows/mypy.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/mypy.yml)
+[![Test Coverage Status](https://coveralls.io/repos/github/lorien/test_server/badge.svg)](https://coveralls.io/github/lorien/test_server)
+[![Documentation Status](https://readthedocs.org/projects/test_server/badge/?version=latest)](http://user-agent.readthedocs.org)
+
+Simple HTTP Server for testing HTTP clients.
+
+
+## Installation
+
+Run `pip install -U test_server`
+
+
+## Usage Example
+
+```python
+from unittest import TestCase
+import unittest
+from urllib.request import urlopen
+
+from test_server import TestServer, Response, HttpHeaderStorage
+
+
+class UrllibTestCase(TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.server = TestServer()
+ cls.server.start()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.server.stop()
+
+ def setUp(self):
+ self.server.reset()
+
+ def test_get(self):
+ self.server.add_response(
+ Response(
+ data=b"hello",
+ headers={"foo": "bar"},
+ )
+ )
+ self.server.add_response(Response(data=b"zzz"))
+ url = self.server.get_url()
+ info = urlopen(url)
+ self.assertEqual(b"hello", info.read())
+ self.assertEqual("bar", info.headers["foo"])
+ info = urlopen(url)
+ self.assertEqual(b"zzz", info.read())
+ self.assertTrue("bar" not in info.headers)
+
+
+ unittest.main()
+```
+
+
+%package -n python3-test-server
+Summary: Server for testing HTTP clients
+Provides: python-test-server
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-test-server
+# Documentation for test_server package
+
+[![Test Status](https://github.com/lorien/test_server/actions/workflows/test.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/test.yml)
+[![Code Quality](https://github.com/lorien/test_server/actions/workflows/check.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/test.yml)
+[![Type Check](https://github.com/lorien/test_server/actions/workflows/mypy.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/mypy.yml)
+[![Test Coverage Status](https://coveralls.io/repos/github/lorien/test_server/badge.svg)](https://coveralls.io/github/lorien/test_server)
+[![Documentation Status](https://readthedocs.org/projects/test_server/badge/?version=latest)](http://user-agent.readthedocs.org)
+
+Simple HTTP Server for testing HTTP clients.
+
+
+## Installation
+
+Run `pip install -U test_server`
+
+
+## Usage Example
+
+```python
+from unittest import TestCase
+import unittest
+from urllib.request import urlopen
+
+from test_server import TestServer, Response, HttpHeaderStorage
+
+
+class UrllibTestCase(TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.server = TestServer()
+ cls.server.start()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.server.stop()
+
+ def setUp(self):
+ self.server.reset()
+
+ def test_get(self):
+ self.server.add_response(
+ Response(
+ data=b"hello",
+ headers={"foo": "bar"},
+ )
+ )
+ self.server.add_response(Response(data=b"zzz"))
+ url = self.server.get_url()
+ info = urlopen(url)
+ self.assertEqual(b"hello", info.read())
+ self.assertEqual("bar", info.headers["foo"])
+ info = urlopen(url)
+ self.assertEqual(b"zzz", info.read())
+ self.assertTrue("bar" not in info.headers)
+
+
+ unittest.main()
+```
+
+
+%package help
+Summary: Development documents and examples for test-server
+Provides: python3-test-server-doc
+%description help
+# Documentation for test_server package
+
+[![Test Status](https://github.com/lorien/test_server/actions/workflows/test.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/test.yml)
+[![Code Quality](https://github.com/lorien/test_server/actions/workflows/check.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/test.yml)
+[![Type Check](https://github.com/lorien/test_server/actions/workflows/mypy.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/mypy.yml)
+[![Test Coverage Status](https://coveralls.io/repos/github/lorien/test_server/badge.svg)](https://coveralls.io/github/lorien/test_server)
+[![Documentation Status](https://readthedocs.org/projects/test_server/badge/?version=latest)](http://user-agent.readthedocs.org)
+
+Simple HTTP Server for testing HTTP clients.
+
+
+## Installation
+
+Run `pip install -U test_server`
+
+
+## Usage Example
+
+```python
+from unittest import TestCase
+import unittest
+from urllib.request import urlopen
+
+from test_server import TestServer, Response, HttpHeaderStorage
+
+
+class UrllibTestCase(TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.server = TestServer()
+ cls.server.start()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.server.stop()
+
+ def setUp(self):
+ self.server.reset()
+
+ def test_get(self):
+ self.server.add_response(
+ Response(
+ data=b"hello",
+ headers={"foo": "bar"},
+ )
+ )
+ self.server.add_response(Response(data=b"zzz"))
+ url = self.server.get_url()
+ info = urlopen(url)
+ self.assertEqual(b"hello", info.read())
+ self.assertEqual("bar", info.headers["foo"])
+ info = urlopen(url)
+ self.assertEqual(b"zzz", info.read())
+ self.assertTrue("bar" not in info.headers)
+
+
+ unittest.main()
+```
+
+
+%prep
+%autosetup -n test-server-0.0.42
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-test-server -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Thu Mar 09 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.42-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..c481e93
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+8b2b76d9d4f19049e79e35f03661e20a test_server-0.0.42.tar.gz