def test_invalid_data(self): """ Test creating a zrobot with invalid data """ with pytest.raises(ValueError, message='template should fail to instantiate if configRepo is sepcified without sshkey'): zrobot = Zrobot(name='zrobot', data={'configRepo': 'https://example.com/account/config'}) zrobot.validate()
def test_valid_data(self): """ Test creating a zrobot service with valid data """ zrobot = Zrobot('zrobot', data=self.valid_data) zrobot.api.services.get = MagicMock() zrobot.validate() assert zrobot.data == self.valid_data
def test_invalid_data(self): """ Test creating a zrobot with invalid data """ with pytest.raises( ValueError, message= 'template should fail to instantiate if data dict is missing the node' ): zrobot = Zrobot(name='zrobot', data={}) zrobot.validate()
def test_install_zrobot_node_not_found(self): """ Test installing a zrobot with no service found for the node """ with pytest.raises( scol.ServiceNotFoundError, message= 'install action should raise an error if node service is not found' ): zrobot = Zrobot('zrobot', data=self.valid_data) zrobot.api.services.get = MagicMock( side_effect=scol.ServiceNotFoundError()) zrobot.validate()