#3797 Fix rawheader_fields tests
Closed 2 years ago by mikem. Opened 2 years ago by jcupova.

Fix rawheader_fields tests
Jana Cupova • 2 years ago  
@@ -23,12 +23,26 @@ 

  

              rh = koji.RawHeader(koji.rip_rpm_hdr(fn))

              hdr = koji.get_rpm_header(fn)

- 

              for key in rh.index:

                  if key in (63, 1141):

                      continue

                  ours = rh.get(key, decode=True)

-                 theirs = hdr[key]

+                 if isinstance(hdr[key], bytes) and not isinstance(ours, bytes):

+                     if isinstance(ours, list):

+                         ours = ours[0].encode('utf-8')

+                     else:

+                         ours = ours.encode('utf-8')

+                     theirs = hdr[key]

+                 else:

+                     if isinstance(hdr[key], list):

+                         theirs = []

+                         for i in hdr[key]:

+                             if isinstance(i, bytes):

+                                 theirs.append(i.decode('utf-8'))

+                             else:

+                                 theirs.append(i)

+                     else:

+                         theirs = hdr[key]

                  if type(ours) != type(theirs):

                      if isinstance(ours, list) and len(ours) == 1 and ours[0] == theirs:

                          # rpm is presenting as a scalar

It was not working on OS image CentOS Linux release 8.4.2105

It was not working on OS image CentOS Linux release 8.4.2105

I'd like to make sure we're not working around a bug.

Can you provide details on the failure?

I've filed #3806 to track this

I am currently unable to replicate #3806

Pull-Request has been closed by mikem

2 years ago
Metadata