aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-03-20 22:05:12 -0700
committerZeyla Hellyer <[email protected]>2017-03-20 22:10:15 -0700
commitcd914f503c8f0ada7473b5b56e4ad7830370ea45 (patch)
tree3f72ca3f878efe2d96a1e64479e6e23dc7c95113 /tests
parentFix deadlock/panic on channel create event for private messages (diff)
downloadserenity-cd914f503c8f0ada7473b5b56e4ad7830370ea45.tar.xz
serenity-cd914f503c8f0ada7473b5b56e4ad7830370ea45.zip
Fix Member methods due to variant joined_at values
Fix an issue where the library would check the Id of the guild that a member is in by checking the Member's ID and joined_at value with those of the members of guilds present in the cache. Performing this check would have the issue of where a joined_at for a member received over websocket would potentially have a varying value than that of the same member retrieved over REST. To fix this, attach the relevant guild's Id to the member on creation, where the Id is available. Fixes #68.
Diffstat (limited to 'tests')
-rw-r--r--tests/README.md21
-rw-r--r--tests/issues/69.rs16
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/README.md b/tests/README.md
new file mode 100644
index 0000000..f67f67d
--- /dev/null
+++ b/tests/README.md
@@ -0,0 +1,21 @@
+### Running the Ignored Test Suite
+
+Some tests are ignored by default, as they require authentication. These should
+only be run when you need to actually test something that _requires_ hitting
+Discord's REST API.
+
+### Generic Tests
+
+Provide the token by setting the environment variable `DISCORD_TOKEN`.
+
+e.g.:
+
+```sh
+$ DISCORD_TOKEN=aaaaaaaaaaa TEST_USER=285951325479632862 cargo test -- --ignored
+```
+
+### Notes for Specific Tests
+
+issues/69:
+
+Provide a `TEST_USER`
diff --git a/tests/issues/69.rs b/tests/issues/69.rs
new file mode 100644
index 0000000..342f7fc
--- /dev/null
+++ b/tests/issues/69.rs
@@ -0,0 +1,16 @@
+extern crate serenity;
+
+use serenity::ext::cache::Cache;
+use serenity::model::event::ChannelCreateEvent;
+use serenity::model::GuildId;
+
+#[ignore]
+fn test_private_channel_create() {
+ let cache = Cache::default();
+
+ let event = ChannelCreateEvent {
+ channel: Channel {
+
+ }
+ }
+}