예제 #1
0
    def test_get_domains_exception(self, mock_logging, mock_dss_client):
        handler = CMDSSHandler(uri='test_uri')

        mock_dss_client.return_value.get_domains.side_effect = dss_error.Error(
            'no domains')

        with self.assertRaises(CMError) as context:
            handler.get_domains()
예제 #2
0
    def test_get_domains(self, mock_logging, mock_dss_client):
        handler = CMDSSHandler(uri='test_uri')

        expected_result = ['a domain', 'b domain', 'c domain']
        mock_dss_client.return_value.get_domains.return_value = expected_result

        domains = handler.get_domains()

        assert domains == expected_result