Ejemplo n.º 1
0
class TestUserDestinationBuilder(unittest.TestCase):
    def setUp(self):
        self.builder = UserDestinationBuilder()

    def test_given_destination_type_user_then_returns_user_destination(self):
        dest = {"type": "user", "user_id": 1}

        expected = UserDestination(user_id=1)

        result = self.builder.build(dest)

        assert_that(result, equal_to(expected))

    @patch("xivo_confd.resources.func_keys.converter.url_for")
    def test_given_destination_then_generates_url(self, url_for):
        dest = UserDestination(user_id=sentinel.user_id)

        expected = url_for.return_value

        result = self.builder.url(dest)

        assert_that(result, equal_to(expected))
        url_for.assert_called_once_with("users.get", _external=True, resource_id=sentinel.user_id)
Ejemplo n.º 2
0
 def setUp(self):
     self.builder = UserDestinationBuilder()