def test_only_other_type(self, mock_find): bindings = [{'repo_id': 'repo1', 'distributor_id': 'some_other_type'}] mock_find.return_value = bindings result = releases.get_bound_repos('consumer1') mock_find.assert_called_once_with('consumer1') self.assertEqual(result, [])
def test_only_puppet(self, mock_find): bindings =[{ 'repo_id': 'repo1', 'distributor_id' : constants.DISTRIBUTOR_TYPE_ID }] mock_find.return_value = bindings result = releases.get_bound_repos('consumer1') mock_find.assert_called_once_with('consumer1') self.assertEqual(result, ['repo1'])
def test_mixed_types(self, mock_find): bindings = [ {'repo_id': 'repo1', 'distributor_id': constants.DISTRIBUTOR_TYPE_ID}, {'repo_id': 'repo2', 'distributor_id': 'some_other_type'}, {'repo_id': 'repo3', 'distributor_id': constants.DISTRIBUTOR_TYPE_ID}, ] mock_find.return_value = bindings result = releases.get_bound_repos('consumer1') mock_find.assert_called_once_with('consumer1') self.assertEqual(result, ['repo1', 'repo3'])
def test_mixed_types(self, mock_find): bindings =[ { 'repo_id': 'repo1', 'distributor_id' : constants.DISTRIBUTOR_TYPE_ID }, { 'repo_id': 'repo2', 'distributor_id' :'some_other_type' }, { 'repo_id': 'repo3', 'distributor_id' : constants.DISTRIBUTOR_TYPE_ID }, ] mock_find.return_value = bindings result = releases.get_bound_repos('consumer1') mock_find.assert_called_once_with('consumer1') self.assertEqual(result, ['repo1', 'repo3'])