Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_serializing_metadata_to_stdout_success(self, metadata, capsys):
flexmock(extract_dist).should_receive('__init__').and_return(None)
command = extract_dist()
command.metadata = metadata
command.stdout = True
command.run()
out, err = capsys.readouterr()
assert not err
def test_serializing_metadata_to_stdout_success(self, metadata, capsys):
flexmock(extract_dist).should_receive('__init__').and_return(None)
command = extract_dist()
command.metadata = metadata
command.stdout = True
command.run()
out, err = capsys.readouterr()
assert not err
def run(self):
"""Sends extracted metadata in json format to stdout if stdout
option is specified, assigns metadata dictionary to class_metadata
variable otherwise.
"""
if self.stdout:
sys.stdout.write("extracted json data:\n" + json.dumps(
self.metadata, default=to_str) + "\n")
else:
extract_dist.class_metadata = self.metadata
def results(self):
return extract_dist.extract_dist.class_metadata