Humbedooh commented on issue #5:
URL:
https://github.com/apache/incubator-ponymail-foal/issues/5#issuecomment-687599931
To make the unit tests align with old pony, we'll need to both detect this
"html source only" status, and inject it into the resulting json:
~~~diff
@@ -415,13 +420,16 @@ class Archiver(object): # N.B. Also used by
import-mbox.py
if body is not None or attachments:
pmid = mid
id_set = set() # Use a set to avoid duplicates
+ which_body = body if body and body.character_set else body and
body.bytes or ""
+ if body.html_as_source:
+ which_body = ""
for generator in self.generator.split(" "):
if generator:
try:
mid = plugins.generators.generate(
generator,
msg,
- body if body and body.character_set else body
and body.bytes or "",
+ which_body,
lid,
attachments,
raw_msg,
@@ -469,6 +477,7 @@ class Archiver(object): # N.B. Also used by
import-mbox.py
"references": msg_metadata["references"],
"in-reply-to": irt,
"body": body.unflow() if body else "",
+ "html_source_only": body.html_as_source,
"attachments": attachments,
}
~~~
Then in the `test-parsing.py`, we need this:
~~~diff
json = archie.compute_updates(fake_args, lid, False,
message, message_raw)
body_sha3_256 = None
if json and json.get('body') is not None:
- body_sha3_256 =
hashlib.sha3_256(json['body'].encode('utf-8')).hexdigest()
+ if not json.get('html_source_only'):
+ body_sha3_256 =
hashlib.sha3_256(json['body'].encode('utf-8')).hexdigest()
if body_sha3_256 != test['body_sha3_256']:
errors += 1
sys.stderr.write("""[FAIL] parsing index %2u: Expected:
%s Got: %s\n""" %
~~~
It puts some limitations on the unit tests - perhaps we need to expand the
yaml settings to allow for differences between the two versions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]