Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Added missing skills tests, fixed locale issues #1054

Merged
merged 1 commit into from
Mar 12, 2021
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 @@ -1499,6 +1499,7 @@ public CompletableFuture<String> getOAuthSignInLink(TurnContext context, AppCred
setBot(activity.getRecipient());
setChannelId(activity.getChannelId());
setConversation(activity.getConversation());
setLocale(activity.getLocale());
setServiceUrl(activity.getServiceUrl());
setUser(activity.getFrom());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class TestAdapter extends BotAdapter implements UserTokenProvider {
private final Queue<Activity> botReplies = new LinkedList<>();
private int nextId = 0;
private ConversationReference conversationReference;
private String locale;
private String locale = "en-us";
private boolean sendTraceActivity = false;
private Map<ExchangableTokenKey, String> exchangableToken = new HashMap<ExchangableTokenKey, String>();

Expand Down Expand Up @@ -93,64 +93,62 @@ public TestAdapter(String channelId) {

public TestAdapter(String channelId, boolean sendTraceActivity) {
this.sendTraceActivity = sendTraceActivity;
setConversationReference(new ConversationReference() {

ConversationReference conversationReference = new ConversationReference();
conversationReference.setChannelId(channelId);
conversationReference.setServiceUrl("https://test.com");
conversationReference.setUser(new ChannelAccount() {
{
setChannelId(channelId);
setServiceUrl("https://test.com");
setUser(new ChannelAccount() {
{
setId("user1");
setName("User1");
}
});
setBot(new ChannelAccount() {
{
setId("bot");
setName("Bot");
}
});
setConversation(new ConversationAccount() {
{
setIsGroup(false);
setConversationType("convo1");
setId("Conversation1");
}
});
setLocale(this.getLocale());
setId("user1");
setName("User1");
}
});
conversationReference.setBot(new ChannelAccount() {
{
setId("bot");
setName("Bot");
}
});
conversationReference.setConversation(new ConversationAccount() {
{
setIsGroup(false);
setConversationType("convo1");
setId("Conversation1");
}
});
conversationReference.setLocale(this.getLocale());

setConversationReference(conversationReference);
}

public TestAdapter(ConversationReference reference) {
if (reference != null) {
setConversationReference(reference);
} else {
setConversationReference(new ConversationReference() {
ConversationReference conversationReference = new ConversationReference();
conversationReference.setChannelId(Channels.TEST);
conversationReference.setServiceUrl("https://test.com");
conversationReference.setUser(new ChannelAccount() {
{
setChannelId(Channels.TEST);
setServiceUrl("https://test.com");
setUser(new ChannelAccount() {
{
setId("user1");
setName("User1");
}
});
setBot(new ChannelAccount() {
{
setId("bot");
setName("Bot");
}
});
setConversation(new ConversationAccount() {
{
setIsGroup(false);
setConversationType("convo1");
setId("Conversation1");
}
});
setLocale(this.getLocale());
setId("user1");
setName("User1");
}
});
conversationReference.setBot(new ChannelAccount() {
{
setId("bot");
setName("Bot");
}
});
conversationReference.setConversation(new ConversationAccount() {
{
setIsGroup(false);
setConversationType("convo1");
setId("Conversation1");
}
});
conversationReference.setLocale(this.getLocale());
setConversationReference(conversationReference);
}
}

Expand Down Expand Up @@ -359,6 +357,7 @@ public Activity makeActivity(String withText) {
setText(withText);
}
};
activity.setLocale(getLocale() != null ? getLocale() : "en-us");

return activity;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ && sendEoCToParent(turnContext)) {
: EndOfConversationCodes.USER_CANCELLED;
Activity activity = new Activity(ActivityTypes.END_OF_CONVERSATION);
activity.setValue(result.getResult());
activity.setLocalTimeZone(turnContext.getActivity().getLocale());
activity.setLocale(turnContext.getActivity().getLocale());
activity.setCode(code);
return turnContext.sendActivity(activity).thenApply(finalResult -> null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class ConfirmPrompt extends Prompt<Boolean> {

/**
* A dictionary of Default Choices based on {@link GetSupportedCultures} . Can
* A map of Default Choices based on {@link GetSupportedCultures} . Can
* be replaced by user using the constructor that contains choiceDefaults.
*/
private Map<String, Triplet<Choice, Choice, ChoiceFactoryOptions>> choiceDefaults;
Expand Down
Loading