Skip to content

Commit c890f85

Browse files
committed
test: outdated module name in integration tests
1 parent 1725cbd commit c890f85

File tree

5 files changed

+48
-44
lines changed

5 files changed

+48
-44
lines changed

.github/workflows/ci_api.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ jobs:
4949

5050
- name: Lint
5151
# currently cli is not-maintained
52-
run: just check
52+
run: |
53+
just fmt-check
54+
just lint
5355
5456
test:
5557
name: Test

api/tests/integration/test_domain.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import app.helpers.producer
1+
import rkapi.app.helpers.producer
22

33

44
class TestDomain:
@@ -18,8 +18,8 @@ def test_domain(self, client, mocker):
1818
- List the domain
1919
- Delete the domain
2020
"""
21-
mocker.patch("app.helpers.producer.kafka_producer")
22-
mocker.patch("app.helpers.producer.send")
21+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
22+
mocker.patch("rkapi.app.helpers.producer.send")
2323
headers = {"X-Api-Key": "123"}
2424

2525
# create user
@@ -52,5 +52,5 @@ def test_domain(self, client, mocker):
5252

5353
# 4: set_config, set_zone, delegate, delegate (creation)
5454
# 5: unset_config, unset_zone (SOA, NS, NS, CNAME)
55-
assert app.helpers.producer.send.call_count == 9
55+
assert rkapi.app.helpers.producer.send.call_count == 9
5656
assert delete_domain_data.status_code == 204

api/tests/integration/test_messages.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import app.helpers.producer
1+
import rkapi.app.helpers.producer
22
import tests.fixtures.messages as message_fx
33

44

@@ -15,8 +15,8 @@ def test_messages(self, client, monkeypatch, mocker):
1515
- Create a domain (with default SOA,NS,CNAME created)
1616
- Assert the sent command
1717
"""
18-
mocker.patch("app.helpers.producer.kafka_producer")
19-
monkeypatch.setattr(app.helpers.producer, "send", self.fake_send)
18+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
19+
monkeypatch.setattr(rkapi.app.helpers.producer, "send", self.fake_send)
2020
headers = {"X-Api-Key": "123"}
2121

2222
# create user

api/tests/integration/test_record.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datetime
22

3-
import app.helpers.helpers
3+
import rkapi.app.helpers.helpers
44
from rkapi.app.controllers.api import record as record_api
55
from rkapi.app.helpers import helpers
66

@@ -27,8 +27,8 @@ def test_add_record(self, client, mocker):
2727
- Add a record
2828
- Query the db to assure it's created
2929
"""
30-
mocker.patch("app.helpers.producer.kafka_producer")
31-
mocker.patch("app.helpers.producer.send")
30+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
31+
mocker.patch("rkapi.app.helpers.producer.send")
3232
headers = {"X-Api-Key": "123"}
3333

3434
# create user
@@ -75,8 +75,8 @@ def test_edit_record(self, client, mocker):
7575
- Edit a record
7676
- Query the db to assure it's edited
7777
"""
78-
mocker.patch("app.helpers.producer.kafka_producer")
79-
mocker.patch("app.helpers.producer.send")
78+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
79+
mocker.patch("rkapi.app.helpers.producer.send")
8080
headers = {"X-Api-Key": "123"}
8181

8282
# create user
@@ -125,8 +125,8 @@ def test_edit_record_no_ttl_change(self, client, mocker):
125125
- Create a domain (with default SOA,NS,CNAME created)
126126
- Edit a record with the same TTL
127127
"""
128-
mocker.patch("app.helpers.producer.kafka_producer")
129-
mocker.patch("app.helpers.producer.send")
128+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
129+
mocker.patch("rkapi.app.helpers.producer.send")
130130
headers = {"X-Api-Key": "123"}
131131

132132
# create user
@@ -168,8 +168,8 @@ def test_edit_record_with_ttl_change(self, client, mocker):
168168
- Edit a record with the different TTL
169169
- Query the db to assure it's edited
170170
"""
171-
mocker.patch("app.helpers.producer.kafka_producer")
172-
mocker.patch("app.helpers.producer.send")
171+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
172+
mocker.patch("rkapi.app.helpers.producer.send")
173173
headers = {"X-Api-Key": "123"}
174174

175175
# create user
@@ -220,8 +220,8 @@ def test_delete_record(self, client, mocker):
220220
- Delete one of the record
221221
- Query the db to assure it's deleted
222222
"""
223-
mocker.patch("app.helpers.producer.kafka_producer")
224-
mocker.patch("app.helpers.producer.send")
223+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
224+
mocker.patch("rkapi.app.helpers.producer.send")
225225
headers = {"X-Api-Key": "123"}
226226

227227
# create user
@@ -260,8 +260,8 @@ def test_edit_record_no_ttl_change_MX(self, client, mocker):
260260
- Add MX record
261261
- Edit a record with the same TTL
262262
"""
263-
mocker.patch("app.helpers.producer.kafka_producer")
264-
mocker.patch("app.helpers.producer.send")
263+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
264+
mocker.patch("rkapi.app.helpers.producer.send")
265265
headers = {"X-Api-Key": "123"}
266266

267267
# create user
@@ -310,8 +310,8 @@ def test_edit_record_with_ttl_change_MX(self, client, mocker):
310310
- Edit a record with the different TTL
311311
- Query the db to assure it's edited
312312
"""
313-
mocker.patch("app.helpers.producer.kafka_producer")
314-
mocker.patch("app.helpers.producer.send")
313+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
314+
mocker.patch("rkapi.app.helpers.producer.send")
315315
headers = {"X-Api-Key": "123"}
316316

317317
# create user
@@ -368,8 +368,8 @@ def test_edit_record_respect_zone_limit(self, client, monkeypatch, mocker):
368368
- Edit a record with the different TXT value until it reaches a limit
369369
- Edit a record with tomorrows date
370370
"""
371-
mocker.patch("app.helpers.producer.kafka_producer")
372-
mocker.patch("app.helpers.producer.send")
371+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
372+
mocker.patch("rkapi.app.helpers.producer.send")
373373
headers = {"X-Api-Key": "123"}
374374

375375
# create user
@@ -430,7 +430,9 @@ def fake_soa_time_set():
430430
tomorrow_date = datetime.datetime.now() + datetime.timedelta(days=1)
431431
return tomorrow_date.strftime("%Y%m%d")
432432

433-
monkeypatch.setattr(app.helpers.helpers, "soa_time_set", fake_soa_time_set)
433+
monkeypatch.setattr(
434+
rkapi.app.helpers.helpers, "soa_time_set", fake_soa_time_set
435+
)
434436
data = {
435437
"zone": "company.com",
436438
"owner": "txt1",

api/tests/integration/test_rules.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def test_duplicate_record(self, client, mocker):
77
- # default CNAME owner is `www`
88
- Add CNAME record with `www` as owner -> must be FAIL (duplicate record)
99
"""
10-
mocker.patch("app.helpers.producer.kafka_producer")
11-
mocker.patch("app.helpers.producer.send")
10+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
11+
mocker.patch("rkapi.app.helpers.producer.send")
1212

1313
headers = {"X-Api-Key": "123"}
1414

@@ -44,8 +44,8 @@ def test_possible_duplicate_record(self, client, mocker):
4444
- Add CNAME record with `www1` as owner.
4545
- Edit CNAME record with `wwww` as owner and `company.com.` as rdata -> must be FAIL (duplicate record)
4646
"""
47-
mocker.patch("app.helpers.producer.kafka_producer")
48-
mocker.patch("app.helpers.producer.send")
47+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
48+
mocker.patch("rkapi.app.helpers.producer.send")
4949

5050
headers = {"X-Api-Key": "123"}
5151

@@ -93,8 +93,8 @@ def test_unique_host(self, client, mocker):
9393
- # default CNAME owner is `www`
9494
- Add CNAME record with `www1` as owner -> must be SUCCESS (unique allowed)
9595
"""
96-
mocker.patch("app.helpers.producer.kafka_producer")
97-
mocker.patch("app.helpers.producer.send")
96+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
97+
mocker.patch("rkapi.app.helpers.producer.send")
9898

9999
headers = {"X-Api-Key": "123"}
100100

@@ -130,8 +130,8 @@ def test_not_unique_host(self, client, mocker):
130130
- # default CNAME owner is `www`
131131
- Add CNAME record with `www` as owner -> must be FAIL (duplicate owner)
132132
"""
133-
mocker.patch("app.helpers.producer.kafka_producer")
134-
mocker.patch("app.helpers.producer.send")
133+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
134+
mocker.patch("rkapi.app.helpers.producer.send")
135135
headers = {"X-Api-Key": "123"}
136136

137137
# create user
@@ -167,8 +167,8 @@ def test_clash_with_A_owner(self, client, mocker):
167167
- Add A record with `host` as owner
168168
- Add CNAME record with `host` as owner -> must be FAIL (clash with A owner)
169169
"""
170-
mocker.patch("app.helpers.producer.kafka_producer")
171-
mocker.patch("app.helpers.producer.send")
170+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
171+
mocker.patch("rkapi.app.helpers.producer.send")
172172
headers = {"X-Api-Key": "123"}
173173

174174
# create user
@@ -213,8 +213,8 @@ def test_duplicate_record(self, client, mocker):
213213
- Add A record with `a1` as owner and `1.1.1.1` as rdata
214214
- Add A record with `a1` as owner and `1.1.1.1` as rdata -> must be FAIL (duplicate record)
215215
"""
216-
mocker.patch("app.helpers.producer.kafka_producer")
217-
mocker.patch("app.helpers.producer.send")
216+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
217+
mocker.patch("rkapi.app.helpers.producer.send")
218218

219219
headers = {"X-Api-Key": "123"}
220220

@@ -260,8 +260,8 @@ def test_possible_duplicate_record(self, client, mocker):
260260
- Add A record with `a1` as owner and `2.2.2.2` as rdata
261261
- Edit A record with `a1` as owner and `1.1.1.1` as rdata -> must be FAIL (duplicate record)
262262
"""
263-
mocker.patch("app.helpers.producer.kafka_producer")
264-
mocker.patch("app.helpers.producer.send")
263+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
264+
mocker.patch("rkapi.app.helpers.producer.send")
265265

266266
headers = {"X-Api-Key": "123"}
267267

@@ -318,8 +318,8 @@ def test_not_unique_owner(self, client, mocker):
318318
- Add A record with `host` as owner
319319
- Add A record with `host` as owner -> must be SUCCESS (same owner allowed)
320320
"""
321-
mocker.patch("app.helpers.producer.kafka_producer")
322-
mocker.patch("app.helpers.producer.send")
321+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
322+
mocker.patch("rkapi.app.helpers.producer.send")
323323
headers = {"X-Api-Key": "123"}
324324

325325
# create user
@@ -363,8 +363,8 @@ def test_clash_with_cname_owner(self, client, mocker):
363363
- Add CNAME record with `host` as owner
364364
- Add A record with `host` as owner -> must be FAIL (clash with CNAME owner)
365365
"""
366-
mocker.patch("app.helpers.producer.kafka_producer")
367-
mocker.patch("app.helpers.producer.send")
366+
mocker.patch("rkapi.app.helpers.producer.kafka_producer")
367+
mocker.patch("rkapi.app.helpers.producer.send")
368368
headers = {"X-Api-Key": "123"}
369369

370370
# create user

0 commit comments

Comments
 (0)