mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-30 05:47:56 +00:00
Add test
This commit is contained in:
parent
dd6f1ba008
commit
99d067d965
@ -74,6 +74,13 @@ class RecordSetServiceIntegrationSpec
|
|||||||
private val auth2 = AuthPrincipal(user2, Seq(sharedGroup.id, group2.id))
|
private val auth2 = AuthPrincipal(user2, Seq(sharedGroup.id, group2.id))
|
||||||
val dummyAuth: AuthPrincipal = AuthPrincipal(testUser, Seq(dummyGroup.id))
|
val dummyAuth: AuthPrincipal = AuthPrincipal(testUser, Seq(dummyGroup.id))
|
||||||
|
|
||||||
|
private val dummyZone = Zone(
|
||||||
|
s"dummy.",
|
||||||
|
"test@test.com",
|
||||||
|
status = ZoneStatus.Active,
|
||||||
|
connection = testConnection,
|
||||||
|
adminGroupId = dummyGroup.id
|
||||||
|
)
|
||||||
private val zone = Zone(
|
private val zone = Zone(
|
||||||
s"live-zone-test.",
|
s"live-zone-test.",
|
||||||
"test@test.com",
|
"test@test.com",
|
||||||
@ -102,6 +109,16 @@ class RecordSetServiceIntegrationSpec
|
|||||||
None,
|
None,
|
||||||
List(AAAAData("fd69:27cc:fe91::60"))
|
List(AAAAData("fd69:27cc:fe91::60"))
|
||||||
)
|
)
|
||||||
|
private val dottedTestRecord = RecordSet(
|
||||||
|
dummyZone.id,
|
||||||
|
"test.dotted",
|
||||||
|
AAAA,
|
||||||
|
38400,
|
||||||
|
RecordSetStatus.Active,
|
||||||
|
DateTime.now,
|
||||||
|
None,
|
||||||
|
List(AAAAData("fd69:27cc:fe91::60"))
|
||||||
|
)
|
||||||
private val subTestRecordA = RecordSet(
|
private val subTestRecordA = RecordSet(
|
||||||
zone.id,
|
zone.id,
|
||||||
"a-record",
|
"a-record",
|
||||||
@ -169,14 +186,6 @@ class RecordSetServiceIntegrationSpec
|
|||||||
adminGroupId = group.id
|
adminGroupId = group.id
|
||||||
)
|
)
|
||||||
|
|
||||||
private val dummyZone = Zone(
|
|
||||||
s"dummy.",
|
|
||||||
"test@test.com",
|
|
||||||
status = ZoneStatus.Active,
|
|
||||||
connection = testConnection,
|
|
||||||
adminGroupId = dummyGroup.id
|
|
||||||
)
|
|
||||||
|
|
||||||
private val highValueDomainRecord = RecordSet(
|
private val highValueDomainRecord = RecordSet(
|
||||||
zone.id,
|
zone.id,
|
||||||
"high-value-domain-existing",
|
"high-value-domain-existing",
|
||||||
@ -283,6 +292,7 @@ class RecordSetServiceIntegrationSpec
|
|||||||
val zoneRecords = List(
|
val zoneRecords = List(
|
||||||
apexTestRecordA,
|
apexTestRecordA,
|
||||||
apexTestRecordAAAA,
|
apexTestRecordAAAA,
|
||||||
|
dottedTestRecord,
|
||||||
subTestRecordA,
|
subTestRecordA,
|
||||||
subTestRecordAAAA,
|
subTestRecordAAAA,
|
||||||
subTestRecordNS,
|
subTestRecordNS,
|
||||||
@ -371,7 +381,7 @@ class RecordSetServiceIntegrationSpec
|
|||||||
"create dotted record succeeds if it satisfies all dotted hosts config" in {
|
"create dotted record succeeds if it satisfies all dotted hosts config" in {
|
||||||
val newRecord = RecordSet(
|
val newRecord = RecordSet(
|
||||||
dummyZone.id,
|
dummyZone.id,
|
||||||
"test.dotted",
|
"testing.dotted",
|
||||||
AAAA,
|
AAAA,
|
||||||
38400,
|
38400,
|
||||||
RecordSetStatus.Active,
|
RecordSetStatus.Active,
|
||||||
@ -388,7 +398,7 @@ class RecordSetServiceIntegrationSpec
|
|||||||
rightValue(result)
|
rightValue(result)
|
||||||
.asInstanceOf[RecordSetChange]
|
.asInstanceOf[RecordSetChange]
|
||||||
.recordSet
|
.recordSet
|
||||||
.name shouldBe "test.dotted"
|
.name shouldBe "testing.dotted"
|
||||||
}
|
}
|
||||||
|
|
||||||
"fail creating dotted record if it satisfies all dotted hosts config except dots-limit for the zone" in {
|
"fail creating dotted record if it satisfies all dotted hosts config except dots-limit for the zone" in {
|
||||||
@ -413,6 +423,29 @@ class RecordSetServiceIntegrationSpec
|
|||||||
leftValue(result) shouldBe a[InvalidRequest]
|
leftValue(result) shouldBe a[InvalidRequest]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"update dotted record succeeds if it satisfies all dotted hosts config" in {
|
||||||
|
val newRecord = dottedTestRecord.copy(ttl = 37000)
|
||||||
|
|
||||||
|
val result = testRecordSetService
|
||||||
|
.updateRecordSet(newRecord, dummyAuth)
|
||||||
|
.value
|
||||||
|
.unsafeRunSync()
|
||||||
|
val change = rightValue(result).asInstanceOf[RecordSetChange]
|
||||||
|
change.recordSet.name shouldBe "test.dotted"
|
||||||
|
change.recordSet.ttl shouldBe 37000
|
||||||
|
}
|
||||||
|
|
||||||
|
"update dotted record name fails as updating a record name is not allowed" in {
|
||||||
|
val newRecord = dottedTestRecord.copy(name = "trial.dotted")
|
||||||
|
|
||||||
|
val result = testRecordSetService
|
||||||
|
.updateRecordSet(newRecord, dummyAuth)
|
||||||
|
.value
|
||||||
|
.unsafeRunSync()
|
||||||
|
// We get an "InvalidRequest: Cannot update RecordSet's name."
|
||||||
|
leftValue(result) shouldBe a[InvalidRequest]
|
||||||
|
}
|
||||||
|
|
||||||
"update apex A record and add trailing dot" in {
|
"update apex A record and add trailing dot" in {
|
||||||
val newRecord = apexTestRecordA.copy(ttl = 200)
|
val newRecord = apexTestRecordA.copy(ttl = 200)
|
||||||
val result = testRecordSetService
|
val result = testRecordSetService
|
||||||
@ -624,6 +657,15 @@ class RecordSetServiceIntegrationSpec
|
|||||||
Some(group2.id)
|
Some(group2.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"delete dotted host record successfully for user in record owner group" in {
|
||||||
|
val result = testRecordSetService
|
||||||
|
.deleteRecordSet(dottedTestRecord.id, dottedTestRecord.zoneId, dummyAuth)
|
||||||
|
.value
|
||||||
|
.unsafeRunSync()
|
||||||
|
|
||||||
|
result should be(right)
|
||||||
|
}
|
||||||
|
|
||||||
"fail deleting for user not in record owner group in shared zone" in {
|
"fail deleting for user not in record owner group in shared zone" in {
|
||||||
val result = leftResultOf(
|
val result = leftResultOf(
|
||||||
testRecordSetService
|
testRecordSetService
|
||||||
|
Loading…
x
Reference in New Issue
Block a user