def test_is_error_not_error(self) -> None: """ Tests of the method whixh checks if the API response is an error for the case that a normal resource type is given. """ expected = False given = { "@type": "user", "@href": "/user/4549848944894848948949", "@representation": "standard", "@permissions": { "read": True, "sync": True }, "id": 4549848944894848948949, "login": "******", "name": "Foo Bar", "github_id": 1148942198798789784897949849484523106, "vcs_id": "1148942198798789784897949849484523106", "vcs_type": "GithubUser", "avatar_url": None, "education": False, "allow_migration": False, "email": "*****@*****.**", "is_syncing": False, "synced_at": "2020-10-14T14:53:08Z", "recently_signed_up": False, "secure_user_hash": None, } actual = Requester.is_error(given) self.assertEqual(expected, actual)
def test_is_error(self) -> None: """ Tests of the method which checks if the API response is an error. """ expected = True given = { "@type": "error", "error_type": "not_found", "error_message": "repository not found (or insufficient access)", "resource_type": "repository", } actual = Requester.is_error(given) self.assertEqual(expected, actual)