From 51c7af082dce46469aab8ef685b3ba6c33ab6068 Mon Sep 17 00:00:00 2001 From: Zed Date: Wed, 17 Jun 2020 17:19:08 +0200 Subject: [PATCH] We no longer know whether profiles are suspended --- src/parser.nim | 9 ++------- src/types.nim | 1 + tests/test_profile.py | 6 +++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/parser.nim b/src/parser.nim index 2354092..f7bdc27 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -25,13 +25,8 @@ proc parseProfile(js: JsonNode; id=""): Profile = result.expandProfileEntities(js) proc parseUserLookup*(js: JsonNode; username: string): Profile = - if js.isNull or js.kind == JArray and js.len == 0: return - with error, js{"errors"}: - result = Profile(username: username) - if error.getError == suspended: - result.suspended = true - return - + if js.isNull or js.kind == JArray and js.len == 0 or "error" in js: + return Profile(username: username) result = parseProfile(js[0]) proc parseGraphProfile*(js: JsonNode; username: string): Profile = diff --git a/src/types.nim b/src/types.nim index aa676f0..44892ce 100644 --- a/src/types.nim +++ b/src/types.nim @@ -12,6 +12,7 @@ type Error* = enum null = 0 + noUserMatches = 17 protectedUser = 22 couldntAuth = 32 doesntExist = 34 diff --git a/tests/test_profile.py b/tests/test_profile.py index 4f08552..f2239da 100644 --- a/tests/test_profile.py +++ b/tests/test_profile.py @@ -71,9 +71,9 @@ class ProfileTest(BaseTestCase): self.open_nitter(username) self.assert_text(f'User "{username}" not found') - def test_suspended(self): - self.open_nitter('test') - self.assert_text('User "test" has been suspended') + # def test_suspended(self): + # self.open_nitter('test') + # self.assert_text('User "test" has been suspended') @parameterized.expand(banner_color) def test_banner_color(self, username, color):