|
|
@@ -121,4 +121,51 @@ describe("Society Operations", function () {
|
|
121
|
121
|
});
|
|
122
|
122
|
}); //end GET /society/view/:societyid
|
|
123
|
123
|
|
|
|
124
|
+ describe("GET /society/view/:societyid/events", function () {
|
|
|
125
|
+ it("shows events for an existing society", function (done) {
|
|
|
126
|
+ request({
|
|
|
127
|
+ url: base_url + "/society/view/foo123soc/events/",
|
|
|
128
|
+ method: "GET",
|
|
|
129
|
+ qs: {
|
|
|
130
|
+ auth: foo123auth
|
|
|
131
|
+ }
|
|
|
132
|
+ }, function (error, response, body) {
|
|
|
133
|
+ body = JSON.parse(body);
|
|
|
134
|
+ expect(response.statusCode).toBe(200);
|
|
|
135
|
+ expect(Array.isArray(body.events)).toBe(true);
|
|
|
136
|
+ expect(body.error).toBe(0);
|
|
|
137
|
+ done();
|
|
|
138
|
+ });
|
|
|
139
|
+ });
|
|
|
140
|
+
|
|
|
141
|
+ it("rejects invalid authentication key", function (done) {
|
|
|
142
|
+ request({
|
|
|
143
|
+ url: base_url + "/society/view/foo123soc/events/",
|
|
|
144
|
+ method: "GET",
|
|
|
145
|
+ qs: {
|
|
|
146
|
+ auth: "foo"
|
|
|
147
|
+ }
|
|
|
148
|
+ }, function (error, response, body) {
|
|
|
149
|
+ body = JSON.parse(body);
|
|
|
150
|
+ expect(response.statusCode).toBe(200);
|
|
|
151
|
+ expect(Array.isArray(body.events)).toBe(true);
|
|
|
152
|
+ expect(body.error).toBe(1);
|
|
|
153
|
+ done();
|
|
|
154
|
+ });
|
|
|
155
|
+ });
|
|
|
156
|
+
|
|
|
157
|
+ it("rejects malformed request", function (done) {
|
|
|
158
|
+ request({
|
|
|
159
|
+ url: base_url + "/society/view/foo123soc/events/",
|
|
|
160
|
+ method: "GET",
|
|
|
161
|
+ }, function (error, response, body) {
|
|
|
162
|
+ body = JSON.parse(body);
|
|
|
163
|
+ expect(response.statusCode).toBe(200);
|
|
|
164
|
+ expect(Array.isArray(body.events)).toBe(true);
|
|
|
165
|
+ expect(body.error).toBe(2);
|
|
|
166
|
+ done();
|
|
|
167
|
+ });
|
|
|
168
|
+ });
|
|
|
169
|
+ });
|
|
|
170
|
+
|
|
124
|
171
|
});
|