Writing a unit test for ng-bootstrap modal (NgbModal) [Angular 6]

I am having some trouble writing unit tests for a confirmation modal I have in my app. Here is the piece of code I would like to test: confirmModal(prompt = ‘Are you sure?’, title = ‘Confirm’): Observable<boolean> { const modal = this.ngbModal.open( ConfirmModalComponent, { backdrop: ‘static’ }); modal.componentInstance.prompt = prompt; modal.componentInstance.title = title; return from(modal.result).pipe(…

Details

TypeError: object of type ‘_io.TextIOWrapper’ has no len ()

I have an error this piece of code: if question == “1”: path = input(“\nEnter the file path\n\n>>> “) name = path.split(“\\”)[-1] with open(name,mode = “r”) as self.message_plain: self.message_plain.read().encode(“utf-8”) The complete code is as follows: from Crypto.Protocol.KDF import scrypt from Crypto.Cipher import AES from Crypto.Random import get_random_bytes class Emisor(): def __init__(self): self.random_password = None self.message_plain…

Details

How to read data from XML like string

I have a response from an api which is xml but doesn’t look properly formatted, how can I format this and get each element. I have tried using simplexml_load_string() but it saves the data and remove the <xml> opening tag. Below is the response I get from the api. <?xml version=”1.0″ encoding=”utf-8″?><string xmlns=”http://hts.org/”>&lt;Info&gt;&lt;Status&gt;1&lt;/Status&gt;&lt;ChasisNo&gt;dfrtdf4543&lt;/ChasisNo&gt;&lt;Color&gt;Black&lt;/Color&gt;&lt;PolicyNo&gt;POL\CR\2014\0000&lt;/PolicyNo&gt;&lt;Model&gt;Hiace&lt;/Model&gt;&lt;Name&gt;Tawakalitu&lt;/Name&gt;&lt;NewRegistrationNo&gt;HB90IKJ&lt;/NewRegistrationNo&gt;&lt;RegistrationNo&gt;HB90IKJ&lt;/RegistrationNo&gt;&lt;Model&gt;Hiace&lt;/Model&gt;&lt;CarMake&gt;Toyota&lt;/CarMake&gt;&lt;VehicleType&gt;hatchback&lt;/VehicleType&gt;&lt;IssueDate&gt;31 DECEMBER 2015&lt;/IssueDate&gt;&lt;ExpirationDate&gt;30…

Details