@@ -9,46 +9,58 @@ def test_scope_singleton():
99 assert Badger .current == GLOBAL_MUG
1010 scope = Badger .current .scope ()
1111 assert scope .context == {}
12+ assert scope .tags == {}
1213 assert scope .stack == []
1314 assert scope == Badger .current .scope ()
1415
1516
1617def test_scope_context ():
1718 scope = Badger .current .scope ()
1819 assert scope .context == {}
20+ assert scope .tags == {}
1921 assert scope .stack == []
2022 with scope :
21- assert scope .stack == [{} ]
23+ assert scope .stack == [({}, {}) ]
2224 scope .context ["foo" ] = "bar"
25+ scope .tags ["name" ] = "value"
2326 with scope :
24- assert scope .stack == [{}, {"foo" : "bar" }]
27+ assert scope .stack == [( {}, {}), ({ "foo" : "bar" }, { "name" : "value" }) ]
2528 assert scope .context == {"foo" : "bar" }
29+ assert scope .tags == {"name" : "value" }
2630 scope .context ["bar" ] = "bazz"
31+ scope .tags ["bar" ] = "bazz"
2732 with scope :
2833 assert scope .context == {"foo" : "bar" , "bar" : "bazz" }
34+ assert scope .tags == {"name" : "value" , "bar" : "bazz" }
2935 scope .context .clear ()
36+ scope .tags .clear ()
3037 assert scope .context == {"foo" : "bar" }
31- assert scope .stack == [{}]
38+ assert scope .tags == {"name" : "value" }
39+ assert scope .stack == [({}, {})]
3240 assert scope .context == {}
41+ assert scope .tags == {}
3342 assert scope .stack == []
3443
3544
3645@pytest .fixture (autouse = True )
37- def init_skd ():
46+ def _init_skd ():
3847 init ("org" , "project" , "token" )
3948
4049
4150def test_create_task_with_scope (httpx_mock ):
4251 with Badger .current .scope () as scope :
4352 scope ["foo" ] = "bar"
4453 scope ["bar" ] = "bazz"
54+ scope .tag ({"name" : "value" })
4555 httpx_mock .add_response (
4656 url = "https://taskbadger.net/api/org/project/tasks/" ,
4757 method = "POST" ,
4858 match_headers = {"Authorization" : "Bearer token" },
49- match_content = b'{"name": "name", "status": "pending", "data": {"foo": "bar", "bar": "buzzer"}}' ,
59+ match_content = b'{"name": "name", "status": "pending", '
60+ b'"data": {"foo": "bar", "bar": "buzzer"}, '
61+ b'"tags": {"name": "value", "name1": "value1"}}' ,
5062 json = _json_task_response (),
5163 status_code = 201 ,
5264 )
53- task = create_task ("name" , data = {"bar" : "buzzer" })
65+ task = create_task ("name" , data = {"bar" : "buzzer" }, tags = { "name1" : "value1" } )
5466 _verify_task (task )
0 commit comments