Example #1
0
 def test_same_method_formats(self, get_user):
     spore_method = build_method_from_link(get_user, ('json', ))
     assert 'formats' not in spore_method
Example #2
0
 def test_specific_method_formats(self, get_user):
     spore_method = build_method_from_link(get_user, ('xml', ))
     assert spore_method['formats'] == ('json', )
Example #3
0
 def test_is_an_optional_parameter(self, get_user_group):
     spore_method = build_method_from_link(get_user_group, ())
     assert 'option' in spore_method['optional_params']
Example #4
0
 def test_is_not_an_optional_parameter(self, get_user_group):
     spore_method = build_method_from_link(get_user_group, ())
     assert 'user_pk' not in spore_method['optional_params']
     assert 'group_pk' not in spore_method['optional_params']
     assert 'not_a_param' not in spore_method['optional_params']
Example #5
0
 def test_is_not_a_path_parameter(self, get_user_group):
     spore_method = build_method_from_link(get_user_group, ())
     assert 'option' not in spore_method['required_params']
Example #6
0
 def test_is_a_query_required_parameter(self, list_filtered_user_groups):
     spore_method = build_method_from_link(list_filtered_user_groups, ())
     assert 'primary' in spore_method['required_params']
Example #7
0
 def test_authenticated_resource(self, authenticated_delete_user):
     spore_method = build_method_from_link(authenticated_delete_user, ())
     assert spore_method['authentication']
Example #8
0
 def test_is_a_required_path_parameter(self, get_user_group):
     spore_method = build_method_from_link(get_user_group, ())
     assert 'user_pk' in spore_method['required_params']
     assert 'group_pk' in spore_method['required_params']
Example #9
0
 def test_payload_patch(self, partial_update_user):
     spore_method = build_method_from_link(partial_update_user, ())
     assert spore_method['method'] == 'patch'
     assert spore_method['payload_required'] == True
     assert spore_method['payload_format'] == 'application/json'
Example #10
0
 def test_payload_put(self, update_user):
     spore_method = build_method_from_link(update_user, ())
     assert spore_method['method'] == 'put'
     assert spore_method['payload_required'] == True
     assert spore_method['payload_format'] == 'multipart/form-data'
Example #11
0
 def test_payload_post(self, create_user):
     spore_method = build_method_from_link(create_user, ())
     assert spore_method['method'] == 'post'
     assert spore_method['payload_required']
     assert spore_method['payload_format'] == \
             'application/x-www-form-urlencoded'
Example #12
0
 def test_no_payload(self, list_users):
     spore_method = build_method_from_link(list_users, ())
     assert spore_method['payload_required'] == False
     assert not hasattr(spore_method, 'payload_format')
Example #13
0
 def test_method_building_globally(self, list_users):
     assert build_method_from_link(list_users, ()) == OrderedDict([
         ('path', '/users/'), ('method', 'get'), ('required_params', []),
         ('optional_params', []), ('payload_required', False),
         ('authentication', False), ('documentation', 'List all users')
     ])