Exemplo n.º 1
0
    def test_pending_transfer_request_for_user(self):
        user = UserFactory()
        datasets = DatasetFactory.create_batch(2, owner=user)
        recipient = UserFactory()
        comment = faker.sentence()
        transfers = {}

        login_user(user)
        for dataset in datasets:
            transfer = request_transfer(dataset, recipient, comment)
            transfers[transfer.id] = transfer

        self.assertEqual(len(transfer_request_notifications(user)), 0)

        notifications = transfer_request_notifications(recipient)
        self.assertEqual(len(notifications), len(datasets))
        for dt, details in notifications:
            transfer = transfers[details['id']]
            self.assertEqual(details['subject']['class'], 'dataset')
            self.assertEqual(details['subject']['id'], transfer.subject.id)
Exemplo n.º 2
0
    def test_pending_transfer_request_for_user(self):
        user = UserFactory()
        datasets = VisibleDatasetFactory.create_batch(2, owner=user)
        recipient = UserFactory()
        comment = faker.sentence()
        transfers = {}

        login_user(user)
        for dataset in datasets:
            transfer = request_transfer(dataset, recipient, comment)
            transfers[transfer.id] = transfer

        assert len(transfer_request_notifications(user)) == 0

        notifications = transfer_request_notifications(recipient)
        assert len(notifications) == len(datasets)
        for dt, details in notifications:
            transfer = transfers[details['id']]
            assert details['subject']['class'] == 'dataset'
            assert details['subject']['id'] == transfer.subject.id
Exemplo n.º 3
0
    def test_pending_transfer_request_for_user(self):
        user = UserFactory()
        datasets = DatasetFactory.create_batch(2, owner=user)
        recipient = UserFactory()
        comment = faker.sentence()
        transfers = {}

        login_user(user)
        for dataset in datasets:
            transfer = request_transfer(dataset, recipient, comment)
            transfers[transfer.id] = transfer

        self.assertEqual(len(transfer_request_notifications(user)), 0)

        notifications = transfer_request_notifications(recipient)
        self.assertEqual(len(notifications), len(datasets))
        for dt, details in notifications:
            transfer = transfers[details['id']]
            self.assertEqual(details['subject']['class'], 'dataset')
            self.assertEqual(details['subject']['id'], transfer.subject.id)
Exemplo n.º 4
0
    def test_pending_transfer_request_for_user(self):
        user = UserFactory()
        datasets = VisibleDatasetFactory.create_batch(2, owner=user)
        recipient = UserFactory()
        comment = faker.sentence()
        transfers = {}

        login_user(user)
        for dataset in datasets:
            transfer = request_transfer(dataset, recipient, comment)
            transfers[transfer.id] = transfer

        assert len(transfer_request_notifications(user)) == 0

        notifications = transfer_request_notifications(recipient)
        assert len(notifications) == len(datasets)
        for dt, details in notifications:
            transfer = transfers[details['id']]
            assert details['subject']['class'] == 'dataset'
            assert details['subject']['id'] == transfer.subject.id