File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+ import requests
3+
4+ from posit .connect ._api import ApiDictEndpoint , ReadOnlyDict
5+ from posit .connect .context import Context
6+ from posit .connect .urls import Url
7+
8+
9+ class TestApiEndpoint :
10+ def test_read_only (self ):
11+ obj = ReadOnlyDict ({})
12+
13+ assert len (obj ) == 0
14+
15+ assert obj .get ("foo" , "bar" ) == "bar"
16+
17+ with pytest .raises (AttributeError ):
18+ obj ["foo" ] = "baz"
19+
20+ obj ._set_attrs (foo = "qux" , a = "b" )
21+ assert len (obj ) == 2
22+ assert obj ["foo" ] == "qux"
23+ assert obj ["a" ] == "b"
24+
25+ def test_api_dict_endpoint (self ):
26+ session = requests .Session ()
27+ ctx = Context (session , Url ("http://connect.example" ))
28+
29+ end = ApiDictEndpoint (ctx = ctx , path = "/some/sub/path" , attrs = {"uid_key" : "guid" })
You can’t perform that action at this time.
0 commit comments