mozilla / PyFxA

Python library for interacting with the Firefox Accounts ecosystem
Other
31 stars 20 forks source link

pypi distfile: test problems #95

Closed 0-wiz-0 closed 1 month ago

0-wiz-0 commented 1 year ago

When running the self tests using the pypi source distfile, many fail because of three missing files:

fxa/tests/bad-key.json
fxa/tests/jwks.json
fxa/tests/private-key.json

Please include them in the distfile.

Also, many more fail because the test server returns 502, for example:

_________________________________________________________________________________ TestCoreClient.test_account_creation _________________________________________________________________________________

self = <fxa.tests.test_core.TestCoreClient testMethod=test_account_creation>                                                                                                                            

    def test_account_creation(self):                                                                                                                                                                    
        acct = TestEmailAccount()                                                                                                                                                                       
        acct.password = DUMMY_PASSWORD                                                                                                                                                                  
>       session = self.client.create_account(acct.email, DUMMY_PASSWORD)                                                                                                                                

fxa/tests/test_core.py:58:                                                                                                                                                                              
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
fxa/core.py:64: in create_account                                                                                                                                                                       
    resp = self.apiclient.post(url, body)                                                                                                                                                               
fxa/_utils.py:338: in post                                                                                                                                                                              
    return self.request("POST", url, json, **kwds)                                                                                                                                                      
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fxa._utils.APIClient object at 0x761ebf01cc20>, method = 'POST', url = 'https://stable.dev.lcip.org/auth/v1/account/create'                                                                     
json = {'authPW': '567643e5ada89e9fc87f1f3b4e8d75a7c6faaa7d7695967c924588a8224b2396', 'email': 'test-2950db5e29@restmail.net'}, retry_auth_errors = True                                                
kwds = {'headers': {'User-Agent': 'Mozilla/5.0 (Mobile; Firefox Accounts; rv:1.0) PyFxA/0.7.7 python-requests/2.31.0'}, 'timeout': 30}, resp = <Response [502]>                                         
headers = {'User-Agent': 'Mozilla/5.0 (Mobile; Firefox Accounts; rv:1.0) PyFxA/0.7.7 python-requests/2.31.0'}, content_type = 'text/html', msg = 'API responded with non-json content-type: {0}'        
...
        # Everything should return a valid JSON response.  Even errors.                                                                                                                                 
        content_type = resp.headers.get("content-type", "")                                                                                                                                             
        if not content_type.startswith("application/json"):                                                                                                                                             
            msg = "API responded with non-json content-type: {0}"                                                                                                                                       
>           raise fxa.errors.OutOfProtocolError(msg.format(content_type))                                                                                                                               
E           fxa.errors.OutOfProtocolError: API responded with non-json content-type: text/html                                                                                                          

fxa/_utils.py:270: OutOfProtocolError                                                                                                                                                                   

No idea how to fix that part.

0-wiz-0 commented 1 month ago

The files are included in 0.7.9, and I didn't see the other problem with that release either. Thanks for fixing them!