@@ -312,3 +312,41 @@ def test_request_throttle(initial_page_size, expected_page_size, mock_response,
312
312
stream .should_retry (response = response )
313
313
314
314
assert stream .page_size == expected_page_size
315
+
316
+
317
+ def test_users_record_transformer ():
318
+ stream = Users (config = MagicMock ())
319
+ response_record = {
320
+ "object" : "user" , "id" : "id" , "name" : "Airbyte" , "avatar_url" : "some url" , "type" : "bot" ,
321
+ "bot" : {"owner" : {"type" : "user" , "user" : {"object" : "user" , "id" : "id" , "name" : "Test User" , "avatar_url" : None , "type" : "person" ,
322
+ "person" : {"email" : "email" }}}, "workspace_name" : "test" }
323
+ }
324
+ expected_record = {
325
+ "object" : "user" , "id" : "id" , "name" : "Airbyte" , "avatar_url" : "some url" , "type" : "bot" ,
326
+ "bot" : {"owner" : {"type" : "user" , "info" : {"object" : "user" , "id" : "id" , "name" : "Test User" , "avatar_url" : None , "type" : "person" ,
327
+ "person" : {"email" : "email" }}}, "workspace_name" : "test" }
328
+ }
329
+ assert stream .transform (response_record ) == expected_record
330
+
331
+
332
+ def test_block_record_transformer ():
333
+ stream = Blocks (parent = None , config = MagicMock ())
334
+ response_record = {
335
+ "object" : "block" , "id" : "id" , "parent" : {"type" : "page_id" , "page_id" : "id" }, "created_time" : "2021-10-19T13:33:00.000Z" , "last_edited_time" : "2021-10-19T13:33:00.000Z" ,
336
+ "created_by" : {"object" : "user" , "id" : "id" }, "last_edited_by" : {"object" : "user" , "id" : "id" }, "has_children" : False , "archived" : False , "type" : "paragraph" ,
337
+ "paragraph" : {"rich_text" : [{"type" : "text" , "text" : {"content" : "test" , "link" : None }, "annotations" : {"bold" : False , "italic" : False , "strikethrough" : False , "underline" : False , "code" : False , "color" : "default" }, "plain_text" : "test" , "href" : None },
338
+ {"type" : "text" , "text" : {"content" : "@" , "link" : None }, "annotations" : {"bold" : False , "italic" : False , "strikethrough" : False , "underline" : False , "code" : True , "color" : "default" }, "plain_text" : "@" , "href" : None },
339
+ {"type" : "text" , "text" : {"content" : "test" , "link" : None }, "annotations" : {"bold" : False , "italic" : False , "strikethrough" : False , "underline" : False , "code" : False , "color" : "default" }, "plain_text" : "test" , "href" : None },
340
+ {"type" : "mention" , "mention" : {"type" : "page" , "page" : {"id" : "id" }}, "annotations" : {"bold" : False , "italic" : False , "strikethrough" : False , "underline" : False , "code" : False , "color" : "default" },
341
+ "plain_text" : "test" , "href" : "https://www.notion.so/id" }], "color" : "default" }
342
+ }
343
+ expected_record = {
344
+ "object" : "block" , "id" : "id" , "parent" : {"type" : "page_id" , "page_id" : "id" }, "created_time" : "2021-10-19T13:33:00.000Z" , "last_edited_time" : "2021-10-19T13:33:00.000Z" ,
345
+ "created_by" : {"object" : "user" , "id" : "id" }, "last_edited_by" : {"object" : "user" , "id" : "id" }, "has_children" : False , "archived" : False , "type" : "paragraph" ,
346
+ "paragraph" : {"rich_text" : [{"type" : "text" , "text" : {"content" : "test" , "link" : None }, "annotations" :{"bold" : False , "italic" : False , "strikethrough" : False , "underline" : False , "code" : False , "color" : "default" }, "plain_text" :"test" , "href" : None },
347
+ {"type" : "text" , "text" : {"content" : "@" , "link" : None }, "annotations" : {"bold" : False , "italic" : False , "strikethrough" : False , "underline" : False , "code" : True , "color" : "default" }, "plain_text" : "@" , "href" : None },
348
+ {"type" : "text" , "text" : {"content" : "test" , "link" : None }, "annotations" : {"bold" : False , "italic" : False , "strikethrough" : False , "underline" : False , "code" : False , "color" : "default" }, "plain_text" : "test" , "href" : None },
349
+ {"type" : "mention" , "mention" : {"type" : "page" , "info" : {"id" : "id" }}, "annotations" : {"bold" : False , "italic" : False , "strikethrough" : False , "underline" : False , "code" : False , "color" : "default" }, "plain_text" : "test" , "href" : "https://www.notion.so/id" }],
350
+ "color" : "default" }
351
+ }
352
+ assert stream .transform (response_record ) == expected_record
0 commit comments