@@ -22,6 +22,12 @@ def test_simple_slug(self):
2222
2323 resp = self .get_success_response (self .organization .slug , monitor .slug )
2424 assert resp .data ["id" ] == str (monitor .guid )
25+ assert resp .data ["slug" ] == "my-monitor"
26+
27+ # GUID based lookup also works
28+ resp = self .get_success_response (self .organization .slug , monitor .guid )
29+ assert resp .data ["id" ] == str (monitor .guid )
30+ assert resp .data ["slug" ] == "my-monitor"
2531
2632 def test_mismatched_org_slugs (self ):
2733 monitor = self ._create_monitor ()
@@ -50,6 +56,24 @@ def test_name(self):
5056 monitor = Monitor .objects .get (id = monitor .id )
5157 assert monitor .name == "Monitor Name"
5258
59+ def test_slug (self ):
60+ monitor = self ._create_monitor ()
61+ resp = self .get_success_response (
62+ self .organization .slug , monitor .guid , method = "PUT" , ** {"slug" : "my-monitor" }
63+ )
64+ assert resp .data ["id" ] == str (monitor .guid )
65+
66+ monitor = Monitor .objects .get (id = monitor .id )
67+ assert monitor .slug == "my-monitor"
68+
69+ # Validate error cases jsut to be safe
70+ self .get_error_response (
71+ self .organization .slug , monitor .guid , method = "PUT" , status_code = 400 , ** {"slug" : "" }
72+ )
73+ self .get_error_response (
74+ self .organization .slug , monitor .guid , method = "PUT" , status_code = 400 , ** {"slug" : None }
75+ )
76+
5377 def test_can_disable (self ):
5478 monitor = self ._create_monitor ()
5579 resp = self .get_success_response (
0 commit comments