Ejemplo n.º 1
0
 def setUp(self):
     self.client = make_connected_client()
     self.disco_server = unittest.mock.Mock()
     self.s = version_svc.VersionServer(self.client,
                                        dependencies={
                                            aioxmpp.disco.DiscoServer:
                                            self.disco_server,
                                        })
Ejemplo n.º 2
0
    def test_try_use_distro_package(self):
        with unittest.mock.patch("distro.name") as name:
            s = version_svc.VersionServer(self.client,
                                          dependencies={
                                              aioxmpp.disco.DiscoServer:
                                              self.disco_server,
                                          })

            name.assert_called_once_with()
            name.reset_mock()

            self.assertEqual(s.os, name())
Ejemplo n.º 3
0
    def test_fallback_to_platform_module(self):
        with unittest.mock.patch("platform.system") as system:
            s = version_svc.VersionServer(self.client,
                                          dependencies={
                                              aioxmpp.disco.DiscoServer:
                                              self.disco_server,
                                          })

            system.assert_called_once_with()
            system.reset_mock()

            self.assertEqual(s.os, system())