コード例 #1
0
    def test_delete_from_share(self, mock_share):
        preprint = PreprintFactory()
        update_share(preprint)

        data = json.loads(mock_share.calls[-1].request.body.decode())
        graph = data['data']['attributes']['data']['@graph']
        share_preprint = next(n for n in graph if n['@type'] == 'preprint')
        assert not share_preprint['is_deleted']

        preprint.date_withdrawn = datetime.now()
        update_share(preprint)

        data = json.loads(mock_share.calls[-1].request.body.decode())
        graph = data['data']['attributes']['data']['@graph']
        share_preprint = next(n for n in graph if n['@type'] == 'preprint')
        assert not share_preprint['is_deleted']

        preprint.spam_status = SpamStatus.SPAM
        update_share(preprint)

        data = json.loads(mock_share.calls[-1].request.body.decode())
        graph = data['data']['attributes']['data']['@graph']
        share_preprint = next(n for n in graph if n['@type'] == 'preprint')
        assert share_preprint['is_deleted']
コード例 #2
0
ファイル: test_views.py プロジェクト: icereval/osf.io
 def flagged_preprint(self):
     flagged_preprint = PreprintFactory()
     flagged_preprint.spam_status = SpamStatus.FLAGGED
     flagged_preprint.save()
     return flagged_preprint
コード例 #3
0
ファイル: test_views.py プロジェクト: icereval/osf.io
 def spam_preprint(self):
     spam_preprint = PreprintFactory()
     spam_preprint.spam_status = SpamStatus.SPAM
     spam_preprint.save()
     return spam_preprint
コード例 #4
0
ファイル: test_views.py プロジェクト: icereval/osf.io
 def ham_preprint(self):
     ham_preprint = PreprintFactory()
     ham_preprint.spam_status = SpamStatus.HAM
     ham_preprint.save()
     return ham_preprint
コード例 #5
0
ファイル: test_views.py プロジェクト: sergiy-neurohub/osf.io
 def flagged_preprint(self):
     flagged_preprint = PreprintFactory()
     flagged_preprint.spam_status = SpamStatus.FLAGGED
     flagged_preprint.save()
     return flagged_preprint
コード例 #6
0
ファイル: test_views.py プロジェクト: sergiy-neurohub/osf.io
 def spam_preprint(self):
     spam_preprint = PreprintFactory()
     spam_preprint.spam_status = SpamStatus.SPAM
     spam_preprint.save()
     return spam_preprint
コード例 #7
0
ファイル: test_views.py プロジェクト: sergiy-neurohub/osf.io
 def ham_preprint(self):
     ham_preprint = PreprintFactory()
     ham_preprint.spam_status = SpamStatus.HAM
     ham_preprint.save()
     return ham_preprint