fn test_get_credentials()

in enclave_build/src/docker.rs [354:395]


    fn test_get_credentials() {
        let test_user = "test_user";
        let test_password = "test_password";
        let auth = format!("{}:{}", test_user, test_password);
        let encoded_auth = general_purpose::STANDARD.encode(auth);
        let config = format!(
            r#"{{
            "auths": {{
              "https://public.ecr.aws/aws-nitro-enclaves/hello/v1/": {{
                "auth": "{}"
              }},
              "https://registry.example.com": {{
                "auth": "b3RoZXJfdXNlcjpvdGhlcl9wYXNzd29yZA=="
              }}
            }}
          }}"#,
            encoded_auth
        );

        // Create a temporary file
        let mut temp_file = NamedTempFile::new().expect("Failed to create temporary file.");

        // Write the config to the temporary file
        write!(temp_file, "{}", config).expect("Failed to write to temporary file.");

        // Set the DOCKER_CONFIG environment variable to point to the temporary file's path
        let temp_file_path = temp_file.path().to_string_lossy().to_string();
        env::set_var("DOCKER_CONFIG", temp_file_path);

        let docker =
            DockerUtil::new(String::from("public.ecr.aws/aws-nitro-enclaves/hello:v1")).unwrap();
        let creds = docker.get_credentials().unwrap();
        assert_eq!(creds.username, Some(test_user.to_string()));
        assert_eq!(creds.password, Some(test_password.to_string()));

        temp_file.close().unwrap();
    }

    #[test]
    fn test_architecture() {
        #[cfg(target_arch = "x86_64")]
        {