Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

matrix-org / synapse / 4532

23 Sep 2019 - 19:39 coverage decreased (-49.7%) to 17.596%
4532

Pull #6079

buildkite

Richard van der Hoff
update changelog
Pull Request #6079: Add submit_url response parameter to msisdn /requestToken

359 of 12986 branches covered (2.76%)

Branch coverage included in aggregate %.

0 of 7 new or added lines in 1 file covered. (0.0%)

18869 existing lines in 281 files now uncovered.

8809 of 39116 relevant lines covered (22.52%)

0.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

42.11
/synapse/federation/persistence.py
1
# -*- coding: utf-8 -*-
2
# Copyright 2014-2016 OpenMarket Ltd
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15

16
""" This module contains all the persistence actions done by the federation
1×
17
package.
18

19
These actions are mostly only used by the :py:mod:`.replication` module.
20
"""
21

22
import logging
1×
23

24
from synapse.logging.utils import log_function
1×
25

26
logger = logging.getLogger(__name__)
1×
27

28

29
class TransactionActions(object):
1×
30
    """ Defines persistence actions that relate to handling Transactions.
31
    """
32

33
    def __init__(self, datastore):
1×
UNCOV
34
        self.store = datastore
!
35

36
    @log_function
1×
37
    def have_responded(self, origin, transaction):
38
        """ Have we already responded to a transaction with the same id and
39
        origin?
40

41
        Returns:
42
            Deferred: Results in `None` if we have not previously responded to
43
            this transaction or a 2-tuple of `(int, dict)` representing the
44
            response code and response body.
45
        """
UNCOV
46
        if not transaction.transaction_id:
Branches [[0, 47], [0, 49]] missed. !
47
            raise RuntimeError("Cannot persist a transaction with no " "transaction_id")
!
48

UNCOV
49
        return self.store.get_received_txn_response(transaction.transaction_id, origin)
!
50

51
    @log_function
1×
52
    def set_response(self, origin, transaction, code, response):
53
        """ Persist how we responded to a transaction.
54

55
        Returns:
56
            Deferred
57
        """
UNCOV
58
        if not transaction.transaction_id:
Branches [[0, 59], [0, 61]] missed. !
59
            raise RuntimeError("Cannot persist a transaction with no " "transaction_id")
!
60

UNCOV
61
        return self.store.set_received_txn_response(
!
62
            transaction.transaction_id, origin, code, response
63
        )
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2019 Coveralls, LLC