diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-02-12 09:47:04 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-02-12 09:47:04 -0500 |
commit | 088ca5fee4cc99f9143f18a880cdec6712326e1e (patch) | |
tree | d46f85076715e69d960beca4726e4ab70a648c3e | |
parent | b455ba94256a4b6afccc7d469ed55c0bda6dc13c (diff) | |
download | bcfg2-088ca5fee4cc99f9143f18a880cdec6712326e1e.tar.gz bcfg2-088ca5fee4cc99f9143f18a880cdec6712326e1e.tar.bz2 bcfg2-088ca5fee4cc99f9143f18a880cdec6712326e1e.zip |
fixed unit tests
-rw-r--r-- | schemas/acl-metadata.xsd | 6 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Plugin/helpers.py | 2 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Plugin/interfaces.py | 6 | ||||
-rw-r--r-- | src/lib/Bcfg2/__init__.py | 3 | ||||
-rw-r--r-- | testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestACL.py | 3 |
5 files changed, 12 insertions, 8 deletions
diff --git a/schemas/acl-metadata.xsd b/schemas/acl-metadata.xsd index 7d996fb87..68994c940 100644 --- a/schemas/acl-metadata.xsd +++ b/schemas/acl-metadata.xsd @@ -21,7 +21,7 @@ negate the sense of the match. </xsd:documentation> </xsd:annotation> - <xsd:group ref="MetadataACLElements"/> + <xsd:group ref="MetadataACLElements" minOccurs="1" maxOccurs="unbounded"/> <xsd:attribute name='name' type='xsd:string'> <xsd:annotation> <xsd:documentation> @@ -61,11 +61,11 @@ Top-level tag for describing metadata-based client ACLs. </xsd:documentation> </xsd:annotation> - <xsd:group ref="MetadataACLElements"/> + <xsd:group ref="MetadataACLElements" minOccurs="1" maxOccurs="unbounded"/> </xsd:complexType> <xsd:group name="MetadataACLElements"> - <xsd:choice minOccurs="1" maxOccurs="unbounded"> + <xsd:choice> <xsd:group ref="py:genshiElements"/> <xsd:element name="Allow" type="MetadataACLType"/> <xsd:element name="Deny" type="MetadataACLType"/> diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py index ae3b84fc2..827c884d2 100644 --- a/src/lib/Bcfg2/Server/Plugin/helpers.py +++ b/src/lib/Bcfg2/Server/Plugin/helpers.py @@ -1171,7 +1171,7 @@ class SpecificData(object): except UnicodeDecodeError: self.data = open(self.name, mode='rb').read() except: # pylint: disable=W0201 - self.logger.error("Failed to read file %s" % self.name) + LOGGER.error("Failed to read file %s" % self.name) class EntrySet(Debuggable): diff --git a/src/lib/Bcfg2/Server/Plugin/interfaces.py b/src/lib/Bcfg2/Server/Plugin/interfaces.py index c1dbb1578..3ef29775d 100644 --- a/src/lib/Bcfg2/Server/Plugin/interfaces.py +++ b/src/lib/Bcfg2/Server/Plugin/interfaces.py @@ -531,7 +531,7 @@ class Version(Plugin): #: be ".svn" __vcs_metadata_path__ = None - __rmi__ = Bcfg2.Server.Plugin.Version.__rmi__ + ['get_revision'] + __rmi__ = Plugin.__rmi__ + ['get_revision'] def __init__(self, core, datastore): Plugin.__init__(self, core, datastore) @@ -602,7 +602,7 @@ class ClientACLs(object): """ ClientACLs are used to grant or deny access to different XML-RPC calls based on client IP or metadata. """ - def check_acl_ip(self, address, rmi): + def check_acl_ip(self, address, rmi): # pylint: disable=W0613 """ Check if the given IP address is authorized to make the named XML-RPC call. @@ -615,7 +615,7 @@ class ClientACLs(object): """ return True - def check_acl_metadata(self, metadata, rmi): + def check_acl_metadata(self, metadata, rmi): # pylint: disable=W0613 """ Check if the given client is authorized to make the named XML-RPC call. diff --git a/src/lib/Bcfg2/__init__.py b/src/lib/Bcfg2/__init__.py new file mode 100644 index 000000000..3fe2a0d75 --- /dev/null +++ b/src/lib/Bcfg2/__init__.py @@ -0,0 +1,3 @@ +"""Base modules definition.""" + +__all__ = ['Server', 'Client', 'Logger', 'Options', 'Proxy', 'Statistics'] diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestACL.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestACL.py index e457ca7c1..86a960701 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestACL.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestACL.py @@ -209,7 +209,8 @@ class TestACL(TestPlugin, TestClientACLs): def test_check_acl_ip(self): acl = self.get_obj() acl.ip_acls = Mock() - self.assertEqual(acl.check_acl_ip("192.168.1.10", "ACL.test"), + self.assertEqual(acl.check_acl_ip(("192.168.1.10", "12345"), + "ACL.test"), acl.ip_acls.check_acl.return_value) acl.ip_acls.check_acl.assert_called_with("192.168.1.10", "ACL.test") |