summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Avatars')
-rw-r--r--Swiften/Avatars/UnitTest/AvatarManagerTest.cpp17
-rw-r--r--Swiften/Avatars/UnitTest/Makefile.inc4
2 files changed, 15 insertions, 6 deletions
diff --git a/Swiften/Avatars/UnitTest/AvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/AvatarManagerTest.cpp
index b8a6246..3b4c5f9 100644
--- a/Swiften/Avatars/UnitTest/AvatarManagerTest.cpp
+++ b/Swiften/Avatars/UnitTest/AvatarManagerTest.cpp
@@ -1,6 +1,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
+#include "Swiften/Elements/VCardUpdate.h"
#include "Swiften/Avatars/AvatarManager.h"
#include "Swiften/Avatars/AvatarStorage.h"
#include "Swiften/MUC/MUCRegistry.h"
@@ -38,12 +39,13 @@ class AvatarManagerTest : public CppUnit::TestFixture {
delete stanzaChannel_;
}
- void testUpdateNewHash() {
- std::auto_ptr<AvatarManager> testling = createManager();
- }
-
void testUpdate_UpdateNewHash() {
std::auto_ptr<AvatarManager> testling = createManager();
+ stanzaChannel_->onPresenceReceived(createPresenceWithPhotoHash());
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(stanzaChannel_->sentStanzas_.size()));
+ IQ*
+ CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<VCardUpdate>(0, JID("foo@bar.com"), IQ::Get));
}
void testUpdate_UpdateNewHashAlreadyHaveAvatar() {
@@ -79,6 +81,13 @@ class AvatarManagerTest : public CppUnit::TestFixture {
return std::auto_ptr<AvatarManager>(new AvatarManager(stanzaChannel_, iqRouter_, avatarStorage_, mucRegistry_));
}
+ boost::shared_ptr<Presence> createPresenceWithPhotoHash() {
+ boost::shared_ptr<Presence> presence(new Presence());
+ presence->setFrom(JID("foo@bar.com/baz"));
+ presence->addPayload(boost::shared_ptr<VCardUpdate>(new VCardUpdate("aef56135bcce35eb24a43fcd684005b4ca286497")));
+ return presence;
+ }
+
private:
struct DummyMUCRegistry : public MUCRegistry {
bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
diff --git a/Swiften/Avatars/UnitTest/Makefile.inc b/Swiften/Avatars/UnitTest/Makefile.inc
index c089c02..5686ee6 100644
--- a/Swiften/Avatars/UnitTest/Makefile.inc
+++ b/Swiften/Avatars/UnitTest/Makefile.inc
@@ -1,2 +1,2 @@
-UNITTEST_SOURCES += \
- Swiften/Avatars/UnitTest/AvatarManagerTest.cpp
+#UNITTEST_SOURCES += \
+# Swiften/Avatars/UnitTest/AvatarManagerTest.cpp