Esempio n. 1
0
 def test_koji_buildsystem(self, mock_koji_login):
     """Assert the buildsystem initializes correctly for koji"""
     config = {'buildsystem': 'koji', 'some': 'key'}
     self.assertTrue(buildsys._buildsystem is None)
     buildsys.setup_buildsystem(config)
     self.assertFalse(buildsys._buildsystem is None)
     buildsys._buildsystem()
     mock_koji_login.assert_called_once_with(config=config)
Esempio n. 2
0
 def test_koji_buildsystem(self, mock_koji_login):
     """Assert the buildsystem initializes correctly for koji"""
     config = {'buildsystem': 'koji', 'some': 'key'}
     assert buildsys._buildsystem is None
     buildsys.setup_buildsystem(config)
     assert buildsys._buildsystem is not None
     buildsys._buildsystem()
     mock_koji_login.assert_called_once_with(authenticate=True,
                                             config=config)
Esempio n. 3
0
    def test_authenticate_false(self, krb_login):
        """If authenticate is set to False, the Koji client should should be unauthenticated."""
        config = {
            'krb_ccache': 'a_ccache', 'krb_keytab': 'a_keytab', 'krb_principal': 'a_principal',
            'buildsystem': 'koji', 'koji_hub': 'https://example.com/koji'}
        self.assertTrue(buildsys._buildsystem is None)

        buildsys.setup_buildsystem(config, authenticate=False)

        # Instantiating the buildsystem should not cause a krb_login to happen.
        buildsys._buildsystem()
        self.assertEqual(krb_login.call_count, 0)
Esempio n. 4
0
    def test_authenticate_true(self, krb_login):
        """If authenticate is set to True, the Koji client should should be authenticated."""
        config = {
            'krb_ccache': 'a_ccache', 'krb_keytab': 'a_keytab', 'krb_principal': 'a_principal',
            'buildsystem': 'koji', 'koji_hub': 'https://example.com/koji'}
        self.assertTrue(buildsys._buildsystem is None)

        buildsys.setup_buildsystem(config, authenticate=True)

        # Instantiating the buildsystem should cause a krb_login to happen.
        buildsys._buildsystem()
        krb_login.assert_called_once_with(ccache='a_ccache', keytab='a_keytab',
                                          principal='a_principal')