Пример #1
0
 def test_add_scope_condition_as_string(self):
     r = Resource('/api')
     r.set_scope(http_method='GET', scope='View')
     assert r.dump() == {
         'path': '/api',
         'conditions': [{
             'httpMethods': ['GET'],
             'scopes': ['View']
         }]
     }
Пример #2
0
 def test_add_scope_condition_as_list(self):
     r = Resource('/api')
     r.set_scope('GET', ['view', 'all'])
     assert r.dump() == {
         'path': '/api',
         'conditions': [{
             'httpMethods': ['GET'],
             'scopes': ['view', 'all']
         }]
     }
Пример #3
0
 def test_adding_another_scope_for_same_http_method_updates_condition(self):
     r = Resource('/api')
     r.set_scope('GET', 'View')
     r.set_scope('GET', 'All')
     assert r.dump() == {
         'path': '/api',
         'conditions': [{
             'httpMethods': ['GET'],
             'scopes': ['View', 'All']
         }]
     }
Пример #4
0
 def test_adding_multiple_http_methods(self):
     r = Resource('/api')
     r.set_scope('GET', 'View')
     r.set_scope('POST', 'Add')
     assert r.dump() == {
         'path':
         '/api',
         'conditions': [{
             'httpMethods': ['GET'],
             'scopes': ['View']
         }, {
             'httpMethods': ['POST'],
             'scopes': ['Add']
         }]
     }