Esempio n. 1
0
    def test_unauthorize_member(self):
        """
        Test unauthorize member
        """
        bootstrap = ZeroosBootstrap('bootstrap', data=self.valid_data)
        bootstrap._unauthorize_member(self.member)

        bootstrap._zt.client.network.updateMember.called_once_with(
            self.member, self.member['nodeId'],
            bootstrap.data['zerotierNetID'])
Esempio n. 2
0
    def test_delete_node(self):
        """
        Test delete node deletes only the node with the right ip
        """
        bootstrap = ZeroosBootstrap('bootstrap', data=self.valid_data)
        bootstrap._unauthorize_member = MagicMock()
        resp = MagicMock()
        resp.json = MagicMock(return_value=[self.member, self.member2])
        bootstrap._zt.client.network.listMembers = MagicMock(return_value=resp)
        bootstrap.delete_node('127.0.0.1')

        bootstrap._unauthorize_member.assert_called_with(self.member2)
Esempio n. 3
0
    def test_bootstrap(self):
        """
        Test creating service with valid data
        """
        bootstrap = ZeroosBootstrap('bootstrap', data=self.valid_data)
        bootstrap.api.get_robot = MagicMock()
        bootstrap._add_node = MagicMock(side_effect=[Exception, None])
        bootstrap._unauthorize_member = MagicMock()
        resp = MagicMock()
        resp.json = MagicMock(return_value=['member1', 'member2'])
        bootstrap._zt.client.network.listMembers = MagicMock(return_value=resp)
        bootstrap.bootstrap()

        bootstrap._unauthorize_member.assert_called_once_with('member1')