2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
Related to zypp_plugins_test.py module.
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
|
|
|
|
|
2021-04-01 16:29:01 -07:00
|
|
|
class Plugin:
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
Bogus module for Zypp Plugins tests.
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
|
|
|
|
2016-05-09 10:33:44 +02:00
|
|
|
def ack(self):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
Acknowledge that the plugin had finished the transaction
|
|
|
|
Returns:
|
|
|
|
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
|
|
|
|
def main(self):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
Register plugin
|
|
|
|
Returns:
|
|
|
|
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
|
|
|
|
|
2021-04-01 16:29:01 -07:00
|
|
|
class BogusIO:
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
Read/write logger.
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
self.content = list()
|
|
|
|
self.closed = False
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return "\n".join(self.content)
|
|
|
|
|
|
|
|
def __call__(self, *args, **kwargs):
|
|
|
|
self.path, self.mode = args
|
|
|
|
return self
|
|
|
|
|
|
|
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
|
|
self.close()
|
|
|
|
|
|
|
|
def __enter__(self):
|
|
|
|
return self
|
|
|
|
|
|
|
|
def write(self, data):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
Simulate writing data
|
|
|
|
Args:
|
|
|
|
data:
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
self.content.append(data)
|
|
|
|
|
|
|
|
def close(self):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
Simulate closing the IO object.
|
|
|
|
Returns:
|
|
|
|
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2016-05-09 10:33:44 +02:00
|
|
|
self.closed = True
|