コード例 #1
0
 def test_set_config_owner(self, mock_metadata):
     mock_metadata.return_value = MockFolder(name='Fake Folder')
     # Settings config updates node settings
     self.node_addon.associated_user_settings = []
     self.node_addon.save()
     res = self.app.put_json(
         self.project.api_url_for('mendeley_set_config'),
         {
             'external_account_id': self.account._id,
             'external_list_id': 'list',
         },
         auth=self.user.auth,
     )
     self.node_addon.reload()
     assert_equal(self.user_addon, self.node_addon.user_settings)
     serializer = MendeleySerializer(node_settings=self.node_addon,
                                     user_settings=self.user_addon)
     expected = {'result': serializer.serialized_node_settings}
     assert_equal(res.json, expected)
コード例 #2
0
 def test_set_config_not_owner(self, mock_metadata):
     mock_metadata.return_value = MockFolder(name='Fake Folder')
     user = AuthUserFactory()
     user.add_addon('mendeley')
     self.project.add_contributor(user)
     self.project.save()
     res = self.app.put_json(
         self.project.api_url_for('mendeley_set_config'),
         {
             'external_account_id': self.account._id,
             'external_list_id': 'list',
         },
         auth=user.auth,
     )
     self.node_addon.reload()
     assert_equal(self.user_addon, self.node_addon.user_settings)
     serializer = MendeleySerializer(node_settings=self.node_addon,
                                     user_settings=None)
     expected = {'result': serializer.serialized_node_settings}
     assert_equal(res.json, expected)