##// END OF EJS Templates
tests: fix integration test wrong named variable
dan -
r436:6048dd9a default
parent child Browse files
Show More
@@ -1,78 +1,78 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import pytest
22 22 import requests
23 23 from mock import Mock, patch
24 24
25 25 from rhodecode import events
26 26 from rhodecode.model.db import Session, Integration
27 27 from rhodecode.model.integration import IntegrationModel
28 28 from rhodecode.integrations.types.base import IntegrationTypeBase
29 29
30 30
31 31 class TestIntegrationType(IntegrationTypeBase):
32 32 """ Test integration type class """
33 33
34 34 key = 'test-integration'
35 35 display_name = 'Test integration type'
36 36
37 37 def __init__(self, settings):
38 38 super(IntegrationTypeBase, self).__init__(settings)
39 39 self.sent_events = [] # for testing
40 40
41 41 def send_event(self, event):
42 42 self.sent_events.append(event)
43 43
44 44
45 45 @pytest.fixture
46 46 def repo_integration_stub(request, repo_stub):
47 47 settings = {'test_key': 'test_value'}
48 48 integration = IntegrationModel().create(
49 49 TestIntegrationType, settings=settings, repo=repo_stub, enabled=True,
50 50 name='test repo integration')
51 51
52 52 @request.addfinalizer
53 53 def cleanup():
54 54 IntegrationModel().delete(integration)
55 55
56 56 return integration
57 57
58 58
59 59 @pytest.fixture
60 60 def global_integration_stub(request):
61 61 settings = {'test_key': 'test_value'}
62 62 integration = IntegrationModel().create(
63 63 TestIntegrationType, settings=settings, enabled=True,
64 64 name='test global integration')
65 65
66 66 @request.addfinalizer
67 67 def cleanup():
68 68 IntegrationModel().delete(integration)
69 69
70 70 return integration
71 71
72 72
73 def test_delete_repo_with_integration_deletes_integration(repo_integration):
74 Session().delete(repo_integration.repo)
73 def test_delete_repo_with_integration_deletes_integration(repo_integration_stub):
74 Session().delete(repo_integration_stub.repo)
75 75 Session().commit()
76 76 Session().expire_all()
77 assert Integration.get(repo_integration.integration_id) is None
77 assert Integration.get(repo_integration_stub.integration_id) is None
78 78
General Comments 0
You need to be logged in to leave comments. Login now