Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Clean up unnecessary TODOs + move test functions to a better location #1209

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,4 @@ class SSOCredentialsProviderTests: XCTestCase {
)
// SUCCESS: creation didn't throw error
}

// TODO: add integration tests that automatically test that SSO crednetials provider correctly exchanges SSO token for temporary AWS credentails.
// Manual integration testing confirmed SSOCredentialsProvider works as of 081723.
}
2 changes: 1 addition & 1 deletion Tests/Services/AWSS3Tests/EndpointResolverTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3428,7 +3428,7 @@ class EndpointResolverTest: XCTestCase {
}
}

/// FIPS + path-only (TODO: consider making this an error)
/// FIPS + path-only
func testResolve123() throws {
let endpointParams = EndpointParams(
bucket: "bucket!",
Expand Down
1 change: 0 additions & 1 deletion codegen/smithy-aws-swift-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugins {
jacoco
}

// TODO: remove once we have all the dependencies in the maven-publish plugin
configurations.implementation {
exclude(group = "brazil")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import software.amazon.smithy.swift.codegen.model.expectShape
data class PresignableOperation(
val serviceId: String,
val operationId: String,
// TODO ~ Implementation of embedded presigned URLs is TBD
// val presignedParameterId: String?
)

class PresignerGenerator : SwiftIntegration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class InputTypeGETQueryItemMiddleware(

val memberTargetShape = ctx.model.expectShape(member.target)
if (memberTargetShape is IntegerShape || memberTargetShape is TimestampShape) {
// TODO: We should support all types in our presignable operations
continue
}
writer.openBlock("if let $memberName = input.operationInput.$memberName {", "}") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ class AWSHttpProtocolRestXMLCustomizations : AWSHttpProtocolCustomizations() {
val properties = mutableListOf<ClientProperty>()
val requestEncoderOptions = mutableMapOf<String, String>()
val responseDecoderOptions = mutableMapOf<String, String>()
// TODO: Subject to change when we figure out which strategy to use for XML
// TODO: Subject to change if Foundation dependency is removed
requestEncoderOptions["dateEncodingStrategy"] = ".secondsSince1970"
requestEncoderOptions["nonConformingFloatEncodingStrategy"] = ".convertToString(positiveInfinity: \"Infinity\", negativeInfinity: \"-Infinity\", nan: \"NaN\")"
responseDecoderOptions["dateDecodingStrategy"] = ".secondsSince1970"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@ import org.junit.jupiter.api.Test
import software.amazon.smithy.aws.swift.codegen.awsjson.AwsJson1_0_ProtocolGenerator
import software.amazon.smithy.aws.swift.codegen.middleware.AWSXAmzTargetMiddleware
import software.amazon.smithy.aws.traits.auth.UnsignedPayloadTrait
import software.amazon.smithy.build.MockManifest
import software.amazon.smithy.codegen.core.SymbolProvider
import software.amazon.smithy.model.Model
import software.amazon.smithy.model.shapes.OperationShape
import software.amazon.smithy.model.shapes.ServiceShape
import software.amazon.smithy.model.shapes.ShapeId
import software.amazon.smithy.model.shapes.StructureShape
import software.amazon.smithy.swift.codegen.SwiftCodegenPlugin
import software.amazon.smithy.swift.codegen.SwiftDelegator
import software.amazon.smithy.swift.codegen.SwiftSettings
import software.amazon.smithy.swift.codegen.SwiftWriter
import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator

class AWSXAmzTargetMiddlewareTests {
@Test
Expand Down Expand Up @@ -62,33 +56,3 @@ stack.serializeStep.intercept(position: .before, middleware: AWSClientRuntime.XA
contents.shouldContainOnlyOnce(expectedContents)
}
}

// TODO: move to proper location once we figure out where that should be
fun Model.newTestContext(
serviceShapeId: String = "com.test#Example",
generator: ProtocolGenerator
): TestContext {
return newTestContext(MockManifest(), serviceShapeId, generator)
}

fun Model.newTestContext(
manifest: MockManifest,
serviceShapeId: String,
generator: ProtocolGenerator
): TestContext {
val settings = SwiftSettings.from(this, TestContextGenerator.buildDefaultSwiftSettingsObjectNode("com.test#Example"))
val provider: SymbolProvider = SwiftCodegenPlugin.createSymbolProvider(this, settings)
val service = this.getShape(ShapeId.from(serviceShapeId)).get().asServiceShape().get()
val delegator = SwiftDelegator(settings, this, manifest, provider)

val ctx = ProtocolGenerator.GenerationContext(
settings,
this,
service,
provider,
listOf(),
generator.protocol,
delegator
)
return TestContext(ctx, manifest)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package software.amazon.smithy.aws.swift.codegen
import org.junit.jupiter.api.Assertions
import software.amazon.smithy.build.MockManifest
import software.amazon.smithy.build.PluginContext
import software.amazon.smithy.codegen.core.SymbolProvider
import software.amazon.smithy.model.Model
import software.amazon.smithy.model.node.Node
import software.amazon.smithy.model.node.ObjectNode
Expand Down Expand Up @@ -139,3 +140,32 @@ fun String.toSmithyModel(sourceLocation: String? = null, serviceShapeId: String?
}
return model
}

fun Model.newTestContext(
serviceShapeId: String = "com.test#Example",
generator: ProtocolGenerator
): TestContext {
return newTestContext(MockManifest(), serviceShapeId, generator)
}

fun Model.newTestContext(
manifest: MockManifest,
serviceShapeId: String,
generator: ProtocolGenerator
): TestContext {
val settings = SwiftSettings.from(this, TestContextGenerator.buildDefaultSwiftSettingsObjectNode("com.test#Example"))
val provider: SymbolProvider = SwiftCodegenPlugin.createSymbolProvider(this, settings)
val service = this.getShape(ShapeId.from(serviceShapeId)).get().asServiceShape().get()
val delegator = SwiftDelegator(settings, this, manifest, provider)

val ctx = ProtocolGenerator.GenerationContext(
settings,
this,
service,
provider,
listOf(),
generator.protocol,
delegator
)
return TestContext(ctx, manifest)
}
Loading