mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 04:41:26 -07:00
[GCE] Google Cloud Pubsub Module (#19091)
* Google Cloud Pubsub Module The Google Cloud Pubsub module allows the Ansible user to: * Create/Delete Topics * Create/Delete Subscriptions * Change subscription from pull to push (and configure endpoint) * Publish messages to a topic * Pull messages from a Subscription An accessory module, gcpubsub_facts, has been added to list topics and subscriptions. * Added docs for state field to DOCUMENTATION and RETURN blocks.
This commit is contained in:
parent
607ef0ce80
commit
c2edc8a264
4 changed files with 555 additions and 22 deletions
41
test/units/module_utils/gcp/test_utils.py
Normal file
41
test/units/module_utils/gcp/test_utils.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2016, Tom Melendez <tom@supertom.com>
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
import os
|
||||
import sys
|
||||
|
||||
from ansible.compat.tests import mock, unittest
|
||||
from ansible.module_utils.gcp import (check_min_pkg_version)
|
||||
|
||||
def build_distribution(version):
|
||||
obj = mock.MagicMock()
|
||||
obj.version = '0.5.0'
|
||||
return obj
|
||||
|
||||
|
||||
class GCPUtilsTestCase(unittest.TestCase):
|
||||
|
||||
@mock.patch("pkg_resources.get_distribution", side_effect=build_distribution)
|
||||
def test_check_minimum_pkg_version(self, mockobj):
|
||||
self.assertTrue(check_min_pkg_version('foobar', '0.4.0'))
|
||||
self.assertTrue(check_min_pkg_version('foobar', '0.5.0'))
|
||||
self.assertFalse(check_min_pkg_version('foobar', '0.6.0'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue