Exemplo n.º 1
0
    def test_add(self, options):
        repository = Mock()

        # test
        remote = Remote('123', repository)
        remote.add()

        # validation
        repository.open.assert_called_once_with()
        repository.impl.remote_add.assert_called_once_with(remote.id, remote.url, options, None)
Exemplo n.º 2
0
    def test_update_not_exist(self, _list):
        repository = Mock()
        _list.return_value = []

        # test
        remote = Remote('123', repository)
        remote.delete = Mock()
        remote.add = Mock()
        remote.update()

        # validation
        _list.assert_called_once_with(repository)
        remote.add.assert_called_once_with()
        self.assertFalse(remote.delete.called)
Exemplo n.º 3
0
    def test_update_not_exist(self, _list):
        repository = Mock()
        _list.return_value = []

        # test
        remote = Remote('123', repository)
        remote.delete = Mock()
        remote.add = Mock()
        remote.update()

        # validation
        _list.assert_called_once_with(repository)
        remote.add.assert_called_once_with()
        self.assertFalse(remote.delete.called)
Exemplo n.º 4
0
    def test_update(self, _list):
        remote_id = '123'
        repository = Mock()
        _list.return_value = [remote_id]

        # test
        remote = Remote(remote_id, repository)
        remote.delete = Mock()
        remote.add = Mock()
        remote.update()

        # validation
        _list.assert_called_once_with(repository)
        remote.delete.assert_called_once_with()
        remote.add.assert_called_once_with()
Exemplo n.º 5
0
    def test_update(self, _list):
        remote_id = '123'
        repository = Mock()
        _list.return_value = [remote_id]

        # test
        remote = Remote(remote_id, repository)
        remote.delete = Mock()
        remote.add = Mock()
        remote.update()

        # validation
        _list.assert_called_once_with(repository)
        remote.delete.assert_called_once_with()
        remote.add.assert_called_once_with()