mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-22 10:10:12 +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))
|
||||
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(
|
||||
s"live-zone-test.",
|
||||
"test@test.com",
|
||||
@ -102,6 +109,16 @@ class RecordSetServiceIntegrationSpec
|
||||
None,
|
||||
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(
|
||||
zone.id,
|
||||
"a-record",
|
||||
@ -169,14 +186,6 @@ class RecordSetServiceIntegrationSpec
|
||||
adminGroupId = group.id
|
||||
)
|
||||
|
||||
private val dummyZone = Zone(
|
||||
s"dummy.",
|
||||
"test@test.com",
|
||||
status = ZoneStatus.Active,
|
||||
connection = testConnection,
|
||||
adminGroupId = dummyGroup.id
|
||||
)
|
||||
|
||||
private val highValueDomainRecord = RecordSet(
|
||||
zone.id,
|
||||
"high-value-domain-existing",
|
||||
@ -283,6 +292,7 @@ class RecordSetServiceIntegrationSpec
|
||||
val zoneRecords = List(
|
||||
apexTestRecordA,
|
||||
apexTestRecordAAAA,
|
||||
dottedTestRecord,
|
||||
subTestRecordA,
|
||||
subTestRecordAAAA,
|
||||
subTestRecordNS,
|
||||
@ -371,7 +381,7 @@ class RecordSetServiceIntegrationSpec
|
||||
"create dotted record succeeds if it satisfies all dotted hosts config" in {
|
||||
val newRecord = RecordSet(
|
||||
dummyZone.id,
|
||||
"test.dotted",
|
||||
"testing.dotted",
|
||||
AAAA,
|
||||
38400,
|
||||
RecordSetStatus.Active,
|
||||
@ -388,7 +398,7 @@ class RecordSetServiceIntegrationSpec
|
||||
rightValue(result)
|
||||
.asInstanceOf[RecordSetChange]
|
||||
.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 {
|
||||
@ -413,6 +423,29 @@ class RecordSetServiceIntegrationSpec
|
||||
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 {
|
||||
val newRecord = apexTestRecordA.copy(ttl = 200)
|
||||
val result = testRecordSetService
|
||||
@ -624,6 +657,15 @@ class RecordSetServiceIntegrationSpec
|
||||
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 {
|
||||
val result = leftResultOf(
|
||||
testRecordSetService
|
||||
|
Loading…
x
Reference in New Issue
Block a user