public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-httmock] epel10.3: Update to 1.3.0
@ 2026-10-10 7:52 Steve Traylen
0 siblings, 0 replies; only message in thread
From: Steve Traylen @ 2026-10-10 7:52 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-httmock
Branch : epel10.3
Commit : 5d192ad7854b41c1591455178409833d05347c7d
Author : Steve Traylen <steve.traylen@cern.ch>
Date : 2019-11-13T12:06:58+01:00
Stats : +43/-3 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/python-httmock/c/5d192ad7854b41c1591455178409833d05347c7d?branch=epel10.3
Log:
Update to 1.3.0
---
diff --git a/.gitignore b/.gitignore
index adc2300..99f6d2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
/httmock-1.2.6.tar.gz
+/httmock-1.3.0.tar.gz
+/tests.py
diff --git a/python-httmock.spec b/python-httmock.spec
index a7c0490..4de895e 100644
--- a/python-httmock.spec
+++ b/python-httmock.spec
@@ -3,8 +3,8 @@
%global pypi_name httmock
Name: python-%{pypi_name}
-Version: 1.2.6
-Release: 9%{?dist}
+Version: 1.3.0
+Release: 1%{?dist}
Summary: A mocking library for requests
License: ASL 2.0
@@ -53,6 +53,9 @@ cp %{SOURCE1} .
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%changelog
+* Wed Nov 13 2019 Steve Traylen <steve.traylen@cern.ch> - 1.3.0-1
+- Update to 1.3.0
+
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.2.6-9
- Rebuilt for Python 3.8.0rc1 (#1748018)
diff --git a/sources b/sources
index be3e2e0..29df162 100644
--- a/sources
+++ b/sources
@@ -1 +1,2 @@
-SHA512 (httmock-1.2.6.tar.gz) = a31b4a28383c052bb15ca5c2f07f96c8654f44d15df05fa7972e410b9c1a40f70c6ed48256dd7cf3a0486f8555142ba59330edd9c8beb003785ecdb535ddfb69
+SHA512 (tests.py) = f869c9923bdd68c8758c1937eb61a7b8e2aae1ef32dce9ca850460dfdfd8daae7c20e1e5b9c298c1ce600900cbe2c34ba9660bd0ded0dbd34e817e39a18eee72
+SHA512 (httmock-1.3.0.tar.gz) = f713ddf45675738582a3611e01a55babce2951231b34fb9ca6b1b64fcf60a3862994ff7ad4cd7a224a116c6acb1caa267978a7cb6fedd02676fa2a01f90e93aa
diff --git a/tests.py b/tests.py
index 7a13cb3..c396192 100644
--- a/tests.py
+++ b/tests.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import requests
import unittest
@@ -41,6 +42,22 @@ def facebook_mock(url, request):
def facebook_mock_count(url, request):
return 'Hello from Facebook'
+@urlmatch(netloc=r'(.*\.)?google\.com$', path=r'^/$', method='POST')
+@remember_called
+def google_mock_store_requests(url, request):
+ return 'Posting at Google'
+
+
+@all_requests
+def charset_utf8(url, request):
+ return {
+ 'content': u'Motörhead'.encode('utf-8'),
+ 'status_code': 200,
+ 'headers': {
+ 'Content-Type': 'text/plain; charset=utf-8'
+ }
+ }
+
def any_mock(url, request):
return 'Hello from %s' % (url.netloc,)
@@ -112,6 +129,13 @@ class MockTest(unittest.TestCase):
with HTTMock(response_content):
self.assertRaises(TypeError, requests.get, 'http://example.com/')
+ def test_encoding_from_contenttype(self):
+ with HTTMock(charset_utf8):
+ r = requests.get('http://example.com/')
+ self.assertEqual(r.encoding, 'utf-8')
+ self.assertEqual(r.text, u'Motörhead')
+ self.assertEqual(r.content, r.text.encode('utf-8'))
+
class DecoratorTest(unittest.TestCase):
@@ -334,3 +358,13 @@ class RememberCalledTest(unittest.TestCase):
self.several_calls(1, requests.get, 'http://facebook.com/')
self.assertEquals(facebook_mock_count.call['count'], 4)
+
+ def test_store_several_requests(self):
+ with HTTMock(google_mock_store_requests):
+ payload = {"query": "foo"}
+ requests.post('http://google.com', data=payload)
+
+ self.assertTrue(google_mock_store_requests.call['called'])
+ self.assertEqual(google_mock_store_requests.call['count'], 1)
+ request = google_mock_store_requests.call['requests'][0]
+ self.assertEqual(request.body, 'query=foo')
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-10 7:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10 7:52 [rpms/python-httmock] epel10.3: Update to 1.3.0 Steve Traylen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox